JohnDoee / autotorrent

Matches torrents with files and gets them seeded
MIT License
269 stars 34 forks source link

UTF errors #42

Closed Motophan closed 4 years ago

Motophan commented 4 years ago

Python3 development and mainline: Rebuilding database Traceback (most recent call last): File "autotorrent-env/bin/autotorrent", line 8, in sys.exit(commandline_handler()) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/cmd.py", line 197, in commandline_handler db.rebuild() File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 159, in rebuild self.insert_into_database(root, f, 'normal') File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 49, in insert_into_database self._insert_into_database(root, f, mode, prefix, unsplitable_name) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 86, in _insert_into_database key = self.keyify(size, normalized_filename) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 282, in keyify return hashlib.sha256(key.encode('utf-8')).hexdigest() UnicodeEncodeError: 'utf-8' codec can't encode character '\udca0' in position 43: surrogates not allowed

Python2 development and mainline: Rebuilding database Traceback (most recent call last): File "autotorrent-env/bin/autotorrent", line 8, in sys.exit(commandline_handler()) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/cmd.py", line 197, in commandline_handler db.rebuild() File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 159, in rebuild self.insert_into_database(root, f, 'normal') File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 49, in insert_into_database self._insert_into_database(root, f, mode, prefix, unsplitable_name) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 86, in _insert_into_database key = self.keyify(size, normalized_filename) File "/home/gentoo/autotorrent-env/lib/python3.7/site-packages/autotorrent/db.py", line 282, in keyify return hashlib.sha256(key.encode('utf-8')).hexdigest() UnicodeEncodeError: 'utf-8' codec can't encode character '\udca0' in position 43: surrogates not allowed

In https://github.com/JohnDoee/autotorrent/pull/16 I would not mind being limited to python2.7 if I could use this.

I tried copying at.py over but it seems the branches have diverged too far.

I have tried downloading and building all locales and have my main set at utf8en

JohnDoee commented 4 years ago

Thanks for reporting this.

This is folded into #45