Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ghost opened this issue Feb 6, 2014 · 4 comments

Comments

@ghost
Copy link

ghost commented Feb 6, 2014

Originally reported by: felixonmars (Bitbucket: felixonmars, GitHub: felixonmars)


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

#!python

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:
ztane/python-Levenshtein#2


@ghost
Copy link
Author

ghost commented Feb 6, 2014

Original comment by felixonmars (Bitbucket: felixonmars, GitHub: felixonmars):


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

#!bash
sed -i -e "s/open('\(README\|CHANGES\|CHANGES (links)\).txt')/open('\1.txt', encoding='utf8')/" setup.py

@ghost
Copy link
Author

ghost commented Feb 6, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Open readme with codecs to enable explicit encoding declaration. Fixes #144.

@ghost
Copy link
Author

ghost commented Feb 6, 2014

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Felix, can you confirm that 2.1.2 fixes the issue in that environment?

@ghost
Copy link
Author

ghost commented Feb 6, 2014

Original comment by felixonmars (Bitbucket: felixonmars, GitHub: felixonmars):


It works!

Thank you Jason, for the super fast fix :)

@ghost ghost added minor bug labels Mar 29, 2016
@ghost ghost closed this as completed Mar 29, 2016
jaraco added a commit that referenced this issue Jun 12, 2022
Fixed Issue on Windows+MSYS2 with unsafe handling of CC config variable.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants