Comment 0 for bug 1373960

Revision history for this message
mm (mm-softwareag) wrote :

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') )