diff --git a/Lib/zoneinfo/_common.pyold b/Lib/zoneinfo/_common.py index 98cdfe37..75f8fd2b 100644 --- a/Lib/zoneinfo/_common.py +++ b/Lib/zoneinfo/_common.py @@ -11,6 +11,12 @@ def load_tzdata(key): try: return resources.files(package_name).joinpath(resource_name).open("rb") except (ImportError, FileNotFoundError, UnicodeEncodeError): + import sys + if "tzdata" not in sys.modules: + raise ZoneInfoNotFoundError( + f"No time zone found with key {key}. \n" + " On Pyodide you must do pyodide.loadPackage('tzdata')" + " package before you use zoneinfo.") # There are three types of exception that can be raised that all amount # to "we cannot find this key": #