Closed forthrin closed 2 years ago
Hi forthrin, thanks for the bug report. Which version of Python are you using to run the script? Also, did the script print out the URL of the trailer it was trying to download when the error happened?
$ python --version
Python 2.7.16
clean_title = 'The Protégé'
Sounds like the same issue
Traceback (most recent call last): File "download_trailers.py", line 599, in <module> main() File "download_trailers.py", line 595, in main download_trailers_from_page(url, settings) File "download_trailers.py", line 278, in download_trailers_from_page settings['video_types']) File "download_trailers.py", line 194, in file_already_downloaded trailer_prefix = '{}.trailer'.format(clean_title.lower()) UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 5: ordinal not in range(128)
Inserting sys.setdefaultencoding('utf8')
(plus some dependencies) at the top of the script resolved the issue for me.
Unfortunately I'm not able to reproduce these crashes, so I don't think I'll be able to fix them. The trailer for film "The Protégé" downloads correctly on my machine. It looks like @forthrin has a possible solution that you can use. Alternatively, I'd encourage you to use Python 3 to run the script. Python 2 reached end of life more than a year ago, and Python 3 uses UTF-8 as the default encoding, so this class of problems shouldn't occur.