Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Dealing with unknown timezones #78

Open
sebix opened this issue Jul 13, 2022 · 0 comments
Open

Dealing with unknown timezones #78

sebix opened this issue Jul 13, 2022 · 0 comments

Comments

@sebix
Copy link
Contributor

sebix commented Jul 13, 2022

If the server's zoneinfo has no information about the timezone, dateutil just raises a warning.
In this example, the server is a Debian 11 Docker container, the server does not know about CEST:

>>> import dateutil.parser
>>> dateutil.parser.parse('Tue 12 Jul 2022 10:47:47 AM CEST', fuzzy=True)
/usr/local/lib/python3.8/dist-packages/dateutil/parser/_parser.py:1207: UnknownTimezoneWarning: tzname CEST identified but not understood.  Pass `tzinfos` argument in order to correctly return a timezone-aware datetime.  In a future version, this will raise an exception.
  warnings.warn("tzname {tzname} identified but not understood.  "
datetime.datetime(2022, 7, 12, 10, 47, 47)

On other systems, CEST is known, so it's not a defect of dateutil or pytz. Maybe it depends on the pytz installation method (if installed from packages/the distribution, the distro's zoneinfo is used, otherwise the built-in timezone infos, which may have a different (smaller) data base).

I suggest to raise an error if the timezone is found, but not unterstood, i.e. converting the warning to an exception.

wagner-intevation added a commit to Intevation/intelmq-cb-mailgen-docker that referenced this issue Jul 14, 2022
work around certat/intelmq-webinput-csv#78
(webinput not knowing about 'CEST'/etc. timezone) by using a different
format (+02:00 syntax) and fixing the comparison step
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant