frankot
frankot

Reputation: 190

Python requests module import error

I have installed python requests module. I used standard pip install requests, the install was successful but it does not work at all. I am not able to import this module to any script file. I always get an error.

Traceback (most recent call last):
  File "D:\Rzeczy Mariusza\Python\aaaa.py", line 3, in <module>
    import requests
  File "D:\Programy\Python34\lib\site-packages\requests\__init__.py", line 58, in <module>
    from . import utils
  File "D:\Programy\Python34\lib\site-packages\requests\utils.py", line 12, in <module>
    import cgi
  File "D:\Programy\Python34\lib\cgi.py", line 39, in <module>
    from email.parser import FeedParser
  File "D:\Programy\Python34\lib\email\parser.py", line 12, in <module>
    from email.feedparser import FeedParser, BytesFeedParser
  File "D:\Programy\Python34\lib\email\feedparser.py", line 27, in <module>
    from email import message
  File "D:\Programy\Python34\lib\email\message.py", line 16, in <module>
    from email import utils
  File "D:\Programy\Python34\lib\email\utils.py", line 40, in <module>
    from email.charset import Charset
  File "D:\Programy\Python34\lib\email\charset.py", line 15, in <module>
    import email.quoprimime
  File "D:\Programy\Python34\lib\email\quoprimime.py", line 44, in <module>
    from string import ascii_letters, digits, hexdigits
ImportError: cannot import name 'ascii_letters'
[Finished in 0.2s with exit code 1]

It is strange, that when I am using IDLE I am able to import it (the module) without any problem. I run Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)] on win32 if that info helps.

Upvotes: 4

Views: 5433

Answers (1)

Ishamael
Ishamael

Reputation: 12795

This usually means that you have a script called string.py in the same folder from which you execute it, and it messes up the imports.

If it is in fact the case, consider renaming it.

Upvotes: 13

Related Questions