Mailing List Archive

zoneinfo and tzdata
The zoneinfo module does not work on Windows unless you have installed
tzdata.

On Ubuntu that data seems to exist already. Not sure how or why but it
obviously isn't there in a Windows virtualenv unless deliberately installed.

I just spent a bit of time trying to switch from pytz to zoneinfo in
Django without luck. I then asked and greatly embarrassed ChatGPT which
kept apologizing when I fed back all the zoneinfo errors its advice caused.

It wasn't until I read the docs that I saw zoneinfo would get timezone
data from tzdata if the real info wasn't where it first looked.

As soon as I installed tzdata, ChatGPT's advice started to work. When I
reported this, it was very grateful and assured me my generosity in
bothering to correct it would be very beneficial for other users having
similar problems.

Might I suggest that if zoneinfo comes up empty-handed it should raise
an error saying no timezone information was found?

Currently, it just nominates the timezone key you attempt to use. Behind
the scenes it surely knows there are no such keys. In that case it might
suggest installing tzdata.

Cheers

Mike
--
https://mail.python.org/mailman/listinfo/python-list