pytz.country_names UnicodeDecodeError exception

Bug #1501456 reported by Robert C Jennings
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-tz (Ubuntu)
Confirmed
Undecided
Unassigned
Nominated for Precise by Robert C Jennings
Nominated for Trusty by Robert C Jennings
Nominated for Vivid by Robert C Jennings

Bug Description

Wily:
# python3 -c 'from pytz import country_names
for item in country_names.items():
  print(item)'
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/lib/python3.4/_collections_abc.py", line 497, in __iter__
    for key in self._mapping:
  File "/usr/lib/python3/dist-packages/pytz/lazy.py", line 41, in __iter__
    self._fill()
  File "/usr/lib/python3/dist-packages/pytz/__init__.py", line 350, in _fill
    line = line.decode('US-ASCII')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

# python -c 'from pytz import country_names
print(country_names)'
Traceback (most recent call last):
  File "<string>", line 2, in <module>
  File "/usr/lib/python2.7/UserDict.py", line 172, in __repr__
    return repr(dict(self.iteritems()))
  File "/usr/lib/python2.7/UserDict.py", line 110, in iteritems
    for k in self:
  File "/usr/lib/python2.7/dist-packages/pytz/lazy.py", line 41, in __iter__
    self._fill()
  File "/usr/lib/python2.7/dist-packages/pytz/__init__.py", line 350, in _fill
    line = line.decode('US-ASCII')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)

# dpkg-query -l python-tz python3-tz tzdata
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii python-tz 2014.10~dfsg all Python version of the Olson timez
ii python3-tz 2014.10~dfsg all Python3 version of the Olson time
ii tzdata 2015f-1 all time zone and daylight-saving tim

Also affect trusty and vivid in the same way. Testing on trusty shows that this broke with the release of tzdata=2015f-0ubuntu0.14.04, prior to that tzdata version country_names could parse the data. debdiff shows that tzdata=2015f-0ubuntu0.14.04 changes this file, and others to utf-8 from ascii.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-tz (Ubuntu):
status: New → Confirmed
Changed in tzdata (Ubuntu):
status: New → Confirmed
Revision history for this message
Andrew Bird (ajb-spheresystems) wrote :

I believe this is the same bug as https://bugs.launchpad.net/pytz/+bug/1473533

Revision history for this message
Robert C Jennings (rcj) wrote :

This affects precise, trusty, and vivid. Please backport this low-risk fix for those releases. Thank you.

Revision history for this message
Robert C Jennings (rcj) wrote :

drat, wrong bug. I meant to put that in bug #1473533

no longer affects: tzdata (Ubuntu)
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.