python-string-utils icon indicating copy to clipboard operation
python-string-utils copied to clipboard

Install fails with UnicodeDecodeError in some locales

Open dcgloe opened this issue 5 years ago • 1 comments

When trying to install python-string-utils with python 3.6 and pip 20.0.2 in a SLES 15 SP1 docker container, the install fails with this error:

    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4lc71oyc/python-string-utils/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4lc71oyc/python-string-utils/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-4lc71oyc/python-string-utils/pip-egg-info
         cwd: /tmp/pip-install-4lc71oyc/python-string-utils/
    Complete output (7 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-4lc71oyc/python-string-utils/setup.py", line 4, in <module>
        long_description = readme.read()
      File "/usr/lib64/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 8392: ordinal not in range(128)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

README.md has some non-ASCII characters, and it appears that the locale in the docker container uses ascii encoding by default. Likely setup.py just needs to specify utf-8 encoding to open README.md.

dcgloe avatar Sep 03 '20 20:09 dcgloe

This line getting trouble: https://github.com/alvistack/daveoncode-python-string-utils/commit/f79d530e9c87571c4fbe69360589797dace0b0ad#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R246

hswong3i avatar Sep 07 '21 16:09 hswong3i