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
bb-migration opened this Issue Feb 6, 2014 · 4 comments

Comments

Projects
None yet
1 participant
@bb-migration

bb-migration 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


@bb-migration

This comment has been minimized.

bb-migration 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
@bb-migration

This comment has been minimized.

bb-migration commented Feb 6, 2014

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


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

@bb-migration

This comment has been minimized.

bb-migration 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?

@bb-migration

This comment has been minimized.

bb-migration commented Feb 6, 2014

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


It works!

Thank you Jason, for the super fast fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment