我在我的电脑上安装了python,pip和easy_install。
这是我得到的import spynner br = spynner.Browser() br.load("http://www.google.com") Traceback (most recent call last): File "C:\Python27\lib\site-packages\spynner\browser.py", line 1674, in createRequest url = six.u(toString(request.url())) File "C:\Python27\lib\site-packages\six.py", line 589, in u return unicode(s.replace(r'\', r'\\'), "unicode_escape") TypeError: decoding Unicode is not supported
在我的Windows 7 64位旗舰版和Python 2.7.8 64位上
我也尝试了32位的python,但给了我同样的错误。有谁能解决这个错误吗?
发布于 2014-09-20 10:26:33
我也有同样的问题。我的直接解决方案是编辑six模块的u()方法。
最初是:
def u(s):
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")我将其更改为:
def u(s):
try:
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
except TypeError as e:
if "decoding Unicode is not supported" in str(e):
return unicode(s.replace(r'\\', r'\\\\'))这只是一种变通方法。希望能有所帮助。
发布于 2014-07-31 18:05:56
我的同事找到了解决方案。
更改安装方法。
使用ez_setup.py
安装spynner
也许最后应该安装PyQt4
https://stackoverflow.com/questions/25041888
复制相似问题