Python 6 library error when using spynner

I installed python, pip and easy_install on my computer. and with the pip command installed by spynner, but I have an error installing autopy, but I solved it with easy_install and after installation, I tried to use spynner, but it gave me a failure error ...

Here is what i have 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

On my Windows 7 64bit Ultimate and Python 2.7.8 64bit

I tried 32 bit python but gave me the same error. Can anyone solve this error?

+4
source share
2 answers

I had the same problem. My immediate solution was to edit the u () method for six modules.

Originally it was:

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'\\\\'))

. , .

+4

.

.

  • Python
  • setuptools, spynner
  • setuptools ez_setup.py
  • spynner
  • PyQt4

, PyQt4

0

All Articles