python-ach icon indicating copy to clipboard operation
python-ach copied to clipboard

Fixing issue with non-ASCII characters in README.rst

Open karthich opened this issue 9 years ago • 0 comments

When I try to install python-ach module in a docker image, I get this error.

Running setup.py (path:/tmp/pip_build_root/ach/setup.py) egg_info for package ach
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/ach/setup.py", line 14, in <module>
        long_description=open('README.rst').read(),
      File "/usr/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 0xe2 in position 234: 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_root/ach/setup.py", line 14, in <module>

    long_description=open('README.rst').read(),

  File "/usr/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 0xe2 in position 234: ordinal not in range(128)

This is an issue with non-ASCII characters being in the README. We can fix this by using codecs.open('README.rst', encoding='utf-8').read() instead of open('README.rst').read() (the change is both python3 and python2 compatible).

Similar to this issue on urllib3: https://github.com/shazow/urllib3/pull/823

karthich avatar Jul 20 '16 17:07 karthich