setup.py needs to open NEWS.rst in utf-8

Bug #1263772 reported by Barry Warsaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GTimeLog
Fix Released
Undecided
Unassigned

Bug Description

Now that I'm building gtimelog for Debian using Python 3, setup.py needs to open NEWS.rst in utf-8, otherwise you get a UnicodeDecodeError:

Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    changes = read('NEWS.rst').split('\n\n\n')
  File "setup.py", line 11, in read
    return f.read()
  File "/usr/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 5725: ordinal not in range(128)

It probably also makes sense to default the setup.py shebang to python3, although that doesn't affect Debian since I believe it invokes it explicitly with `python3 setup.py <command>`.

For gtimelog 0.9.1-1 in Debian, I'll quilt patch this for now. See attached.

Revision history for this message
Barry Warsaw (barry) wrote :
Revision history for this message
Marius Gedminas (mgedmin) wrote :

This is only a problem when your locale is not UTF-8. I've added a setenv = LC_ALL=C to tox.ini so this'll be regression tested, and used io.open() so it'll continue to work on Python 2.

Changed in gtimelog:
status: New → Fix Committed
Revision history for this message
Marius Gedminas (mgedmin) wrote :

I believe this fix was included in the 0.9.2 release I made a while ago.

Changed in gtimelog:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.