mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
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:
parent
e899586408
commit
e4e04c4ba2
1 changed files with 5 additions and 2 deletions
|
@ -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:
|
if j['region'] == '' or regions is None or len(regions) == 0 or j['region'] in regions:
|
||||||
day = j['date'].replace("-", "_")
|
day = j['date'].replace("-", "_")
|
||||||
desc = j['description']
|
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:
|
except HTTPError as e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue