-2

I am attempting to run an existing program on a computer while overseas. When I click to run the .exe program it states to see the log file. When viewing the logfile it says:

Traceback (most recent call last):
File "itchycats.py", line 1249, in module
File "itchycats.py", line 808, in main
File "itchycats.py", line 326, in GetProfileInfo
File "sabnzbd\misc.pyo", line 281, in get_user_shellfolders
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 40-41: ordinal not in range(256)

I keep searching this UnicodeEncodeError: 'latin-1' ,am I able to edit the program code even though I did not create it. I do not have python or any of the other software I have read on threads discussing 'unicodeencodeerror' Is there something I can run to make my computer run this program. I have never had an issue on other computers but this is a borrowed hp notebook in Taiwan. The windows is a non-multilingual version so I cannot change it to English (which is why I think I am getting this error). Other than spending my week in Asia learning how to become a programmer are there any tips to run this software correctly?

1 Answers1

1

sabnzbd won't work right on any machine with characters in a shell folder path that don't exist in ISO 8859-1.

Error occurs in misc.py:

name, value, val_type = _winreg.EnumValue(key, i)
values[name] = value.encode('latin-1')

That's a bit silly. The encoding (‘code page’) that Windows will be using for byte-string filenames is the ‘ANSI code page’, which will only be like ISO 8859-1 (‘latin-1’) on Western European machines, and even then not exactly the same.

The right encoding would be 'mbcs', which replicates that code page whatever it is set to. However, that still wouldn't work on the off-chance you had shell folders with characters that don't fit in the ANSI code page.

The proper answer is to leave the Unicode string alone, don't encode it to bytes at all. Python for Windows has perfectly good support for native Unicode filenames (which is a great feature; it's one of the very few cross-platform languages to do so). Persuade sabnzbd devs to remove this encoding stuff and just use Unicode strings.

bobince
  • 528,062
  • 107
  • 651
  • 834