TI-42: holiday calendar error when downloading nb-NO

When downloading the holiday calendar for the nb-NO locale with Python 2
the code throws an 'ascii' encode error.
This commit is contained in:
Jelle van der Waa 2016-09-03 21:26:49 +02:00 committed by Paul Beckingham
parent e899586408
commit e4e04c4ba2

View file

@ -72,8 +72,11 @@ def update_single_year(locales, regions, year):
if j['region'] == '' or regions is None or len(regions) == 0 or j['region'] in regions:
day = j['date'].replace("-", "_")
desc = j['description']
fh.write(' %s = %s\n' % (day, desc))
data = ' %s = %s\n' % (day, desc)
if sys.version_info >= (3,0):
fh.write(data)
else:
fh.write(data.encode('utf-8'))
except HTTPError as e:
if e.code == 404: