seomoz / url-py

URL Transformation, Sanitization
MIT License
103 stars 20 forks source link

Python 3.5.1 AttributeError: 'str' object has no attribute 'decode' #37

Closed gtors closed 8 years ago

gtors commented 8 years ago

This code cause exception:

import url
url.parse('http://example.com')
b4hand commented 8 years ago

It would be a lot more helpful if you gave the full stack trace in an error report.

I can reproduce this:

$ python
Python 3.5.1 (default, Mar 18 2016, 08:38:49)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import url
>>> url.parse('http://example.com')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/brandon/.pyenv/versions/3.5.1/lib/python3.5/site-packages/url.py", line 54, in parse
    return URL.parse(url, encoding)
  File "/Users/brandon/.pyenv/versions/3.5.1/lib/python3.5/site-packages/url.py", line 85, in parse
    url.decode(encoding).encode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
b4hand commented 8 years ago

FWIW, this is a general incompatibility with Python 3, rather than something specific to Python 3.5.1. Currently this package does not support Python 3, but we would accept a pull request that provided such compatibility.

b4hand commented 8 years ago

Closing as a duplicate of #3.