Sperryfreak01 / RadarrSync

120 stars 46 forks source link

Can't handle Unicode characters #3

Open jfeeser opened 6 years ago

jfeeser commented 6 years ago

When running the script, i get the following error below:

2018-04-17 15:44:00,709 [MainThread  ] [INFO ]  Starting new HTTP connection (1): 10.100.2.130
2018-04-17 15:44:01,023 [MainThread  ] [INFO ]  Starting new HTTP connection (1): 10.100.2.130
Traceback (most recent call last):
  File "RadarrSync.py", line 79, in <module>
    logging.debug('path: {0}'.format(movie['path']))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 31: ordinal not in range(128)

(That's the entire contents of the error log)

My guess is that it's due to the fact that i have movies that have non-ascii characters in the titles, such as "Alien³". Can you take a look?

hjone72 commented 6 years ago

try adjusting line 12 https://github.com/Sperryfreak01/RadarrSync/blob/master/RadarrSync.py#L14 to look like this:

fileHandler = logging.FileHandler("./Output.txt",'w','utf-8')

That resolved the output to log errors I was getting but I still get them for the console output. Fortunately the movie still adds.

Sperryfreak01 commented 6 years ago

I haven't had any unicode issues, what version of python are you running on.

juchong commented 4 years ago

Adding this workaround in case someone else runs into this issue:

You can also "fix" the issue by changing the default encoding used by python2. To do this, you have to edit /usr/lib/python2.7/site.py and change the default value on line 485 from ascii to utf-8