Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same error with every torrent. #6

Closed
tejt99 opened this issue Aug 3, 2019 · 2 comments
Closed

Same error with every torrent. #6

tejt99 opened this issue Aug 3, 2019 · 2 comments

Comments

@tejt99
Copy link

tejt99 commented Aug 3, 2019

Hi I was just having a look at this and I downloaded a test torrent using 'BitTorrent Now' and I got an error so I tried it on different files and I got the same one. It looks like this

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 290, in _next_string
string = raw.decode(encoding, self._error_handler)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pytp", line 10, in
sys.exit(__main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 633, in __main
target_file, not args.dict, args.coding, args.errors
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 202, in parse
data = self._next_element()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 350, in _next_element
element = self._type_to_func(element_type)()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 254, in _next_dict
for key, element in self._dict_items_generator():
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 247, in _dict_items_generator
v = self._next_element(k)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 350, in _next_element
element = self._type_to_func(element_type)()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 254, in _next_dict
for key, element in self._dict_items_generator():
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 247, in _dict_items_generator
v = self._next_element(k)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 348, in _next_element
element = self._type_to_func(element_type)(field=field)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 306, in _next_string
''.join(msg)
torrent_parser.InvalidTorrentDataException: Fail to decode string at pos 1242 using encoding utf-8 when parser field "originator", maybe it is an hash field. You can use self.hash_field("originator") to let it be treated as hash value, so this error may disappear
USER-MacBook:torrent_parser-master USER$ sudo pytp 'FOOL'S GOLD DAY OFF FIRE.torrent'
-bash: unexpected EOF while looking for matching `''
-bash: syntax error: unexpected end of file
USER-MacBook:torrent_parser-master USER$ sudo pytp "FOOL'S GOLD DAY OFF FIRE.torrent"
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 290, in _next_string
string = raw.decode(encoding, self._error_handler)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 1: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/pytp", line 10, in
sys.exit(__main())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 633, in __main
target_file, not args.dict, args.coding, args.errors
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 202, in parse
data = self._next_element()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 350, in _next_element
element = self._type_to_func(element_type)()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 254, in _next_dict
for key, element in self._dict_items_generator():
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 247, in _dict_items_generator
v = self._next_element(k)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 350, in _next_element
element = self._type_to_func(element_type)()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 254, in _next_dict
for key, element in self._dict_items_generator():
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 247, in _dict_items_generator
v = self._next_element(k)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 348, in _next_element
element = self._type_to_func(element_type)(field=field)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/torrent_parser.py", line 306, in _next_string
''.join(msg)
torrent_parser.InvalidTorrentDataException: Fail to decode string at pos 1242 using encoding utf-8 when parser field "originator", maybe it is an hash field. You can use self.hash_field("originator") to let it be treated as hash value, so this error may disappear

I don't know if this is a known error. I assume the last error is the only informative one. This appears when using cli and as a module. I am running on mac OS python3.

@7sDream
Copy link
Owner

7sDream commented Aug 3, 2019

Looks like your torrent file has a originator field which contains non-utf8 bytes.

If you are using the pytp CLI, try pytp some.torrent -e ignore.

If you are using this module in your code, try TorrentFileParse(f, errors="ignore").


Or you can upload your test torrent file so I can figure out what originator fields mean.

@tejt99
Copy link
Author

tejt99 commented Aug 4, 2019

Thanks

@tejt99 tejt99 closed this as completed Aug 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants