rtorrent-cleanup
rtorrent-cleanup copied to clipboard
Unicode error
When running this script (only tested with the --dry parameter), I get the following error:
found 889 downloaded files
found 879 rtorrent files
Traceback (most recent call last):
File "~/./rtorrent_cleanup.py", line 154, in <module>
main(args.rtorrent_working_dir, args.rtorrent_download_dirs)
File "~/./rtorrent_cleanup.py", line 90, in main
if check_if_single_file_torrent(torrent_file):
File "~/./rtorrent_cleanup.py", line 21, in check_if_single_file_torrent
content = f.read()
File "/usr/lib/python-exec/python3.9/../../../lib/python3.9/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 876: invalid continuation byte
I guess one of my downloads contains some weird unicode that can't be parsed in utf-8... but I'm not sure which? I haven't dabbled in python yet...
You could add a print(torrent_file_path)
before line 20 and then the last file it prints before the error is the problem.
I identified the torrent file, removed it, so it wouldn't hang again but then it crapped its pants with the next torrent file: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfa in position 1243: invalid start byte
Kinda don't want to do this for potentially every single torrent in there...