I would like to first thank you for the library :)
I ran into a little trouble while trying to use it with Python2. This happens when it is attempted to convert the entire data to be parsed as ascii. However in my humble opinion, I think the content to be converted need not be converted to ascii as any torrent file will obviously contain non-printable ascii characters, resulting in UnicodeDecodeError.
Python 2.7.11 (default, Mar 31 2016, 06:18:34)
[GCC 5.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import bencoder
>>> data = open("../archlinux-2016.06.01-dual.iso.torrent","rb").read()
>>> bencoder.decode(data)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "bencoder.py", line 90, in decode
s = s.encode("ascii")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbe in position 267: ordinal not in range(128)
Removing this particular block of code, which attempts the ascii conversion, seems to make it work flawlessly in Python2.
89 if isinstance(s, str):
90 s = s.encode("ascii")
I would like to first thank you for the library :)
I ran into a little trouble while trying to use it with Python2. This happens when it is attempted to convert the entire data to be parsed as
ascii
. However in my humble opinion, I think the content to be converted need not be converted toascii
as any torrent file will obviously contain non-printable ascii characters, resulting inUnicodeDecodeError
.Removing this particular block of code, which attempts the
ascii
conversion, seems to make it work flawlessly in Python2.Attached the torrent file, I was attempting to decode. archlinux-2016.06.01-dual.iso.torrent.zip