Timezone lookups failing for some installations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python |
Fix Released
|
Unknown
|
|||
pytz |
Fix Released
|
Medium
|
Stuart Bishop |
Bug Description
I have version 2009g installed on AIX. US/Eastern is not in the timezone information. America/New_York is not either. The strange thing is that I have the same version installed on Linux and they are there. I installed both from downloading the tgz from the pytz web site. The python version is different on the two systems. I would like to be able to find something that works the same on both systems. Either US/Eastern or America/New_York.
Here is the AIX information:
$ python
Python 2.6 (r26:66714, Oct 28 2008, 16:33:58) [C] on aix5
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> pytz.__version__
'2009g'
>>> 'US/Eastern' in pytz.common_
False
>>> 'US/Eastern' in pytz.common_
False
>>> 'US/Eastern' in pytz.all_timezones
False
>>> pytz.country_
['America/
>>> 'America/New_York' in pytz.all_timezones
False
Here is the Linux information:
brente@belmer:~$ python
Python 2.5.4 (r254:67916, Feb 17 2009, 20:16:45)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pytz
>>> pytz.__version__
'2009g'
>>> 'US/Eastern' in pytz.common_
True
>>> 'US/Eastern' in pytz.all_timezones
True
>>> pytz.country_
['America/
>>> 'America/New_York' in pytz.all_timezones
True
Related branches
summary: |
- US/Eastern not database + US/Eastern not in database |
summary: |
- US/Eastern not in database + Timezone lookups failing for some installations |
Changed in pytz: | |
status: | Fix Released → Confirmed |
Changed in python: | |
status: | Unknown → New |
Changed in pytz: | |
status: | Confirmed → Fix Released |
assignee: | nobody → Stuart Bishop (stub) |
Changed in python: | |
status: | New → Fix Released |
The source timezone lists are hardcoded in pytz/__init__.py, and are identical on all installations. However, they are filtered at runtime to cope with missing timezone data files (a number of installations are modified to use the system installed timezone data rather than the files distributed with pytz). I think the difference you see could be caused by an incompatible version or a bug in the pkg_resources module, which is normally distributed as part of setuptools.
pkg_resources doesn't seem to contain a version identifier, so I'm not sure how to check what version is installed.
Upgrading pkg_resources to the latest version might solve the problem.
pkg_resources is needed if the timezone data files are inside a .egg. We can avoid using pkg_resources unless absolutely necessary by checking for the existence of the calculated data file path on disk first, and only attempting to load using pkg_resources. resource_ stream if that file does not exist.