Installation failed to run on python 3.x when command line encoding is not utf8 and readme_file contains non-ASCII characters

Felix Yan avatarFelix Yan created an issue

readme_file.read() will try to use 'ascii' to decode, and thus failed. For example, set LANG=C and get this:

Traceback (most recent call last):
  File "setup.py", line 93, in <module>
    long_description = readme_file.read() + '\n' + changes_file.read()
  File "/usr/lib/python3.3/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 7330: ordinal not in range(128)

I filed a patch for the same problem to python-Levenshtein, hope it helps: https://github.com/ztane/python-Levenshtein/pull/2

Comments (5)

  1. Felix Yan

    Note: The easiest workaround I'm currently using is:

    sed -i -e "s/open('\(README\|CHANGES\|CHANGES (links)\).txt')/open('\1.txt', encoding='utf8')/" setup.py
    
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.