cached-property icon indicating copy to clipboard operation
cached-property copied to clipboard

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 561: ordinal not in range(128)

Open mbehrle opened this issue 9 years ago • 3 comments

Building with python3.4 on Debian:

I: pybuild base:170: python3.4 setup.py clean Traceback (most recent call last): File "setup.py", line 15, in history = open('HISTORY.rst').read().replace('.. :changelog:', '') File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] i : 'ascii' codec can't decode byte 0xe2 in position 561: ordinal not in range(128)

mbehrle avatar May 12 '15 12:05 mbehrle

Sounds like you need to set your system LOCALE to UTF-8 or they need to manually specify a locale when opening the docs.

SamWhited avatar May 24 '15 22:05 SamWhited

I've recently seen this error a bunch with tests running under Tox. Tox 2 sanitizes the environment, including the LOCALE, so Python 3 can't properly guess the environment's encoding.

The solution I've used in my projects is to do open(fn, 'rb').read().decode('utf-8') instead of just open(fn).read().

ryanhiebert avatar May 24 '15 22:05 ryanhiebert

A similar issue occurred with cookiecutter last week: https://github.com/audreyr/cookiecutter/pull/453

pydanny avatar May 25 '15 01:05 pydanny