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

specify utf-8 encoding in setup.py #13

Closed
dwieeb opened this issue Jul 7, 2014 · 1 comment

Comments

@dwieeb
Copy link

commented Jul 7, 2014

When the module is being setup, you are defaulting to system-level encoding, which can sometimes be ascii, which fails when it parses the non-ascii character here: https://github.com/rbarrois/python-semanticversion/blob/master/semantic_version/__init__.py#L6.

Traceback (most recent call last): File "", line 17, in File "/sites/preprod/.virtual_python/build/semantic-version/setup.py", line 31, in version=get_version(PACKAGE), File "/sites/preprod/.virtual_python/build/semantic-version/setup.py", line 19, in get_version for line in f: File "/sites/preprod/.virtual_python/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 167: ordinal not in range(128) Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 17, in File "/sites/preprod/.virtual_python/build/semantic-version/setup.py", line 31, in version=get_version(PACKAGE), File "/sites/preprod/.virtual_python/build/semantic-version/setup.py", line 19, in get_version for line in f: File "/sites/preprod/.virtual_python/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 167: ordinal not in range(128)

This is probably what you wanna do before parsing files in setup.py:

import sys
sys.setdefaultencoding("UTF-8")

An alternative fix is to set
LANG="en_us.UTF-8"
in .bashrc of the user that does the pip install

@zdexter

This comment has been minimized.

Copy link

commented Sep 23, 2014

Also experiencing this issue when installing via Python 3.4 on Ubuntu server latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.