pwdyson/inflect.py — pull request #18 by dashea (2014-07-08 17:42:16+00:00)
Title: Open README.rst explicitly as utf-8 in Python 3

When building with Python 3, reading the contents of README.rst into long_description can be problematic. Python 3 will attempt to decode the file, and whether it can correctly do so as utf-8 depends on the locale settings.

$ LANG=C python3 setup.py build
Traceback (most recent call last):
File "setup.py", line 9, in
readme = open(readme_path).read()
File "/usr/lib64/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 47693: ordinal not in range(128)

This fixes that by adding an encoding parameter to open() available in Python 3.