ZoneInfoNotFoundError
is a subclass of keyError1
. It is raised by the ZoneInfo
class constructor if no matching file is found on the search path.
Possible reasons for errors:
Note: The
ZoneInfo
module is only available in Python version 3.9 or higher.
In the example below:
ZoneInfo
class.America/New_York
to raise ZoneInfoNotFoundError
.from zoneinfo import ZoneInfozone = ZoneInfo("America/NewYork")print(zone)
Check key
spelling:
from zoneinfo import ZoneInfozone = ZoneInfo("America/New_York")print(zone)
Check available time zones in your system:
ZoneInfo
module provides the zoneinfo.available_timezones()
function to get the set of available time zones in your system.import zoneinfofor zone in zoneinfo.available_timezones():print(zone)