Allow to set different 'zoneinfo' directory

Bug #1373959 reported by mm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pytz
Triaged
Medium
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 the

    filename = os.path.join(os.path.dirname(__file__), 'zoneinfo', *name_parts)

to

    filename = os.path.join(zoneinfo_dir, *name_parts)

and insert on module level

    zoneinfo_dir = os.path.join(os.path.dirname(__file__), 'zoneinfo')

In this way, the user of might

    zoneinfo_dir = os.environ.get('TZDATADIR', os.path.join(os.path.dirname(__file__), 'zoneinfo') )

Stuart Bishop (stub)
Changed in pytz:
status: New → Triaged
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.