UnicodeDecodeError in tox install if LC_ALL = C #223

Closed
smoser opened this Issue Feb 24, 2015 · 9 comments

Comments

Projects
None yet
4 participants

smoser commented Feb 24, 2015

if LC_ALL is 'C', then installation in a tox environment fails.
Removing the 'setenv' block allows it to work.

$ cat tox.ini
[tox]
envlist = py34
recreate = True

[testenv]
commands = python -c 'import sys; sys.exit(0)'
deps =
    httpretty
setenv =
    LC_ALL = C

$ cat setup.py
from distutils.core import setup
setup(
    name="MyApplication", version="0.1.0",
    author="foo", author_email="foo@example.com",
)

$ rm -Rf .tox; tox -c tox.ini  -v
...
Downloading/unpacking httpretty
  Running setup.py (path:/tmp/pip-build-t5a7ox6l/httpretty/setup.py) egg_info for package httpretty
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 86, in <module>
        version=read_version(),
      File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 46, in read_version
        finder.visit(ast.parse(local_file('httpretty', '__init__.py')))
      File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 78, in <lambda>
        open(os.path.join(os.path.dirname(__file__), *f)).read()
      File "/tmp/my/.tox/py34/lib/python3.4/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 133: ordinal not in range(128)
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 86, in <module>
    version=read_version(),
  File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 46, in read_version
    finder.visit(ast.parse(local_file('httpretty', '__init__.py')))
  File "/tmp/pip-build-t5a7ox6l/httpretty/setup.py", line 78, in <lambda>
    open(os.path.join(os.path.dirname(__file__), *f)).read()
  File "/tmp/my/.tox/py34/lib/python3.4/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 133: ordinal not in range(128)

@smoser smoser changed the title from UnicodeDecodeError in tox install if LANG = C to UnicodeDecodeError in tox install if LC_ALL = C Feb 24, 2015

smoser commented Feb 24, 2015

It seems that this appeared in 0.8.1 (using deps of 'httpretty==0.8.0' passes, but 'httpretty==0.8.1' fails).

smoser commented Feb 24, 2015

seems likely to be related to 42b2476 and the unicode seen there in readme.rst

Contributor

syndbg commented Mar 13, 2015

Just tested it with 0.8.8. It's fixed 👍

smoser commented Mar 25, 2015

Well, the original test case that I opened with above is still failing.
see http://paste.ubuntu.com/10679735/ .
Note, this is python3 that fails. python2 does not.
Also recreates with
LANG=C pip3 install --root=./x httpretty

dies with:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 133: ordinal not in range(128)
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

Did you find any workaround @smoser?

smoser commented May 14, 2015

The easiest work around is to just install with a utf-8 locale. (en_US.utf-8)

Thanks @smoser! Do you happen to know if the locale for the Travis build environment suddenly changed since yesterday? Or is only spotify/luigi affected by this?

@Tarrasch Tarrasch referenced this issue in spotify/luigi May 14, 2015

Closed

Test `test_get_info` is failing #951

smoser commented May 14, 2015

On Wed, 13 May 2015, Arash Rouhani wrote:

Thanks @smoser! Do you happen to know if the locale for the Travis build environment suddenly changed since yesterday? Or is only spotify/luigi affected by this?

I don't know.
I just fixed my tox environment by adding 'LC_ALL' to the setenv.

old:
setenv = VIRTUAL_ENV={envdir}

new:
setenv = VIRTUAL_ENV={envdir}
LC_ALL = en_US.utf-8

aviau commented May 14, 2015

Same issue here

Tarrasch added a commit to spotify/luigi that referenced this issue May 15, 2015

Test environment: Set encoding to utf8
This hopefully will make a few more tests pass.

See #951 and gabrielfalcao/HTTPretty#223 (comment)

e3krisztian added a commit to e3krisztian/bead that referenced this issue May 19, 2015

travis & tox fix for installing github requirement (omlite)
tox-2.0.1: UnicodeDecodeError in tox install if LC_ALL = C

was working with tox 1.8.1
Solution found at
gabrielfalcao/HTTPretty#223
spotify/luigi@fec2b37

openstack-gerrit pushed a commit to openstack/python-ironicclient that referenced this issue May 25, 2015

httpretty can fail in Python 3.4 with wrong LC_ALL
if LC_ALL is 'C' then installation in a tox environment fails [1].

[1] gabrielfalcao/HTTPretty#223

Change-Id: I340c88ea7d098ca5943d60adc73f63a0af79a405

openstack-gerrit added a commit to openstack/openstack that referenced this issue May 25, 2015

Updated openstack/openstack
Project: openstack/python-ironicclient  530bacab548cf22b00e56be21db1079b0bcc1695

httpretty can fail in Python 3.4 with wrong LC_ALL

if LC_ALL is 'C' then installation in a tox environment fails [1].

[1] gabrielfalcao/HTTPretty#223

Change-Id: I340c88ea7d098ca5943d60adc73f63a0af79a405

tarekziade added a commit to loads/loads-broker that referenced this issue May 28, 2015

BenjamenMeyer added a commit to TestInABox/stackInABox that referenced this issue May 29, 2015

tarekziade added a commit to loads/loads-broker that referenced this issue May 29, 2015

guyzmo pushed a commit to guyzmo/pybitbucket that referenced this issue Nov 29, 2016

fixed Python3 build issue
Problem on Docker image looks like this issue:
gabrielfalcao/HTTPretty#223
Workaround is to explicitly set LC_ALL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment