zhongwuzw
zhongwuzw

Reputation: 156

Error when using requests In Python2.7

import requests
r = requests.get('http://bbs.byr.cn/')
print r

The error:

Traceback (most recent call last): File "E:\MyPythonRoad\src\requeststest.py", line 1, in import requests File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests__init__.py", line 58, in from . import utils File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\utils.py", line 25, in from .compat import parse_http_list as _parse_list_header File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\compat.py", line 7, in from .packages import chardet File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\packages__init__.py", line 3, in from . import urllib3 File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\packages\urllib3__init__.py", line 16, in from .connectionpool import ( File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\packages\urllib3\connectionpool.py", line 36, in from .connection import ( File "C:\Python27\lib\site-packages\requests-2.3.0-py2.7.egg\requests\packages\urllib3\connection.py", line 43, in from .util import ( ImportError: No module named util

Upvotes: 1

Views: 1802

Answers (1)

Daniel
Daniel

Reputation: 971

requests

Since you are using Windows, you may want to try to reinstall requests through this binary.

urllib3

According to this, you may want to try manual download the util folder from urilib3 from the download at the bottom of pypi, and add it to the urllib3 install location.

Upvotes: 1

Related Questions