Allow to set different 'zoneinfo' directory
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pytz |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
pytz should provide a simple way to set a different 'zoneinfo' directory for the timezone files.
This could be used to switch to the installed OS files or in my case to easier switch zoneinfo versions.
One solution could be to change in the open_resource(name) function in __init__.py :
filename = os.path.
to
filename = os.path.
and insert on module level
zoneinfo_dir = os.path.
In this way, the calling program is able to set the directory to a different one:
import pytz
pytz.
Another option could be to evaluate an environment variable e.g. TZDATADIR and use its string as zoneinfo directory
zoneinfo_dir = os.environ.
A change would support the question discussed in
https:/
description: | updated |
Changed in pytz: | |
status: | Fix Committed → Fix Released |
An environment variable seems appropriate here, to avoid the issue where a module (eg. a third party dependency) has already been imported and retrieved, causing timezones to appear from data in the unwanted path.