-
-
Notifications
You must be signed in to change notification settings - Fork 412
Closed
Description
The following happens on Amazon Linux AMI release 2018.03 with pendulum 2.0.0 (but also with 1.5.1):
Python 3.4.8 (default, Apr 25 2018, 23:50:36)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pendulum.tz.local_timezone import _get_unix_timezone
>>> _get_unix_timezone()
Traceback (most recent call last):
File "/home/dmitrii/.local/lib/python3.4/site-packages/pendulum/tz/zoneinfo/reader.py", line 49, in read_for
file_path = pytzdata.tz_path(timezone)
File "/usr/local/lib/python3.4/site-packages/pytzdata/__init__.py", line 74, in tz_path
raise TimezoneNotFound('Timezone {} not found at {}'.format(name, filepath))
pytzdata.exceptions.TimezoneNotFound: Timezone /usr/share/zoneinfo/Europe/Zurich not found at /usr/local/lib/python3.4/site-packages/pytzdata/zoneinfo/usr/share/zoneinfo/Europe/Zurich
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dmitrii/.local/lib/python3.4/site-packages/pendulum/tz/local_timezone.py", line 206, in _get_unix_timezone
return Timezone(etctz.replace(' ', '_'))
File "/home/dmitrii/.local/lib/python3.4/site-packages/pendulum/tz/timezone.py", line 30, in __init__
tz = read(name, extend=extended)
File "/home/dmitrii/.local/lib/python3.4/site-packages/pendulum/tz/zoneinfo/__init__.py", line 9, in read
return Reader(extend=extend).read_for(name)
File "/home/dmitrii/.local/lib/python3.4/site-packages/pendulum/tz/zoneinfo/reader.py", line 51, in read_for
raise InvalidTimezone(timezone)
pendulum.tz.zoneinfo.exceptions.InvalidTimezone: Invalid timezone "/usr/share/zoneinfo/Europe/Zurich"
The issue seems to be that _get_unix_timezone is unable to parse the string 'ZONE="/usr/share/zoneinfo/Europe/Zurich"\n which is returned when the zonefile is read.
I think the issue is here that you expect there Europe/Zurich.
austinbutler
Metadata
Metadata
Assignees
Labels
No labels