Loading all the timezone objects is definitely the most thorough check, but it takes at least 300 milliseconds. Checking that the timezone files exist with os.path.isfile only takes 4 milliseconds.
>>> for timezone_name in pytz.common_timezones:
... if not os.path.isfile(os.path.join(dir, timezone_name)):
... pytz.common_timezones.remove(timezone_name)
Loading all the timezone objects is definitely the most thorough check, but it takes at least 300 milliseconds. Checking that the timezone files exist with os.path.isfile only takes 4 milliseconds.
>>> for timezone_name in pytz.common_ timezones: isfile( os.path. join(dir, timezone_name)): timezones. remove( timezone_ name)
... if not os.path.
... pytz.common_