Closed sebastic closed 5 years ago
Although I couldn't reproduce the problem, I agree that explicit decoding is definitively the right thing to do here.
Personally, I'd avoid the Python 3 if/else, though and just explicitly decode
:
with open('README.md', 'rb') as fh:
data = fh.read()
data = data.decode('utf-8')
Using decode
works too, but since the with
statement was added in Python 2.5 the interpreter version requirements should probably be documented in setup.py
too.
I agree, Python versions (2.7 and 3.x) should be specified in setup.py.
python_requires
has been added to setup.py
, see:
https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
Looks good, thanks for the swift fix!
As mentioned in #169,
setup.py
fails to read theREADME.md
due to anUnicodeDecodeError
.This is fixed by explicitly setting the encoding, and using the
codecs
library with Python 2.7.