davidfoerster/aptsources-cleanup

UnicodeEncodeError: 'latin-1' codec can't encode character '\u201c' in position 9: ordinal not in range(256)

Closed this issue · 2 comments

Any help appreciated. I've tried google-ing the error and I find lots of unrelated, seemingly unhelpful stuff. I presume this is some system misconfiguration issue, but I've no idea what the problem is:

OS version info (/etc/os-release):

NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Result of attempting to run as described on Ubuntu help pages:

$ python3 -OEs aptsources-cleanup.zip 
Overlapping source entries:
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "aptsources-cleanup.zip/__main__.py", line 9, in <module>
  File "/usr/lib/python3.5/runpy.py", line 199, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 362, in <module>
  File "aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 45, in main
  File "aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 277, in handle_duplicates
  File "aptsources-cleanup.zip/aptsources_cleanup/util/terminal.py", line 147, in print
UnicodeEncodeError: 'latin-1' codec can't encode character '\u201c' in position 9: ordinal not in range(256)

If the issue arises again could you please include the output of the locale command? Thanks.

Will do. I ended up editing the aptsources by hand...
Here's the locale output from the machine that exhibited the problem:

LANG=en_US
LANGUAGE=en_US:
LC_CTYPE=en_US.UTF-8
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=