I got this import error, which as this answer indicates occurs because the requests
package is out of date. I updated the package using pip
, but still got the same error. So I tried from requests.utils import to_native_string
, which to my surprise works just fine in either the command prompt shell or IDLE, but throws an error in Spyder. I checked the version of the requests
package:
import requests
print(requests.__version__)
The version number in Spyder ('1.2.3'
) is indeed different from the version number in IDLE or the cmd shell ('2.7.0'
). I am a loss to explain why this would be the case, however, because Spyder points to the same interpreter at C:\Python27\python.exe
and if I check the version of python being used:
import sys
print(sys.version)
I get the same result everywhere: '2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]'
.