#436 Timezone Problem

closed-works-for-me
pythonwin (177)
5
2012-01-28
2009-07-11
No

I've been wrestling with the timezone module in pywin32 for several of days and was wondering if any one here might know how to solve the following Keyword: 'Std' error.

I've looked at the code and double checked my system registry and there is an entry for Std in each of the timezones in the hive.

Here is a listing from PythonWin and what can be done to repeat the failure:

PythonWin 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)] on win32.
Portions Copyright 1994-2008 Mark Hammond - see 'Help/About PythonWin' for further copyright information.
>>> import os
>>> import sys
>>> import time
>>> import pywin32
>>> import pywin32api
>>> import win32api
>>> import win32file
>>> import win32timezone
>>> import datetime
>>> assert 'Mountain Standard Time' in win32timezone.TimeZoneInfo.get_sorted_time_zone_names()
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 588, in get_sorted_time_zone_names
tzs = TimeZoneInfo.get_sorted_time_zones()
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 606, in get_sorted_time_zones
zones = TimeZoneInfo.get_all_time_zones()
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 594, in get_all_time_zones
return [TimeZoneInfo(n) for n in TimeZoneInfo._get_time_zone_key_names()]
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 594, in <listcomp>
return [TimeZoneInfo(n) for n in TimeZoneInfo._get_time_zone_key_names()]
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 385, in __init__
self._LoadInfoFromKey()
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 406, in _LoadInfoFromKey
key = self._FindTimeZoneKey()
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 392, in _FindTimeZoneKey
zoneNames = dict(self._get_indexed_time_zone_keys('Std'))
File "C:\Python30\lib\site-packages\win32\lib\win32timezone.py", line 581, in get_index_value
return key[index_key]
KeyError: 'Std'

Thanks

Discussion

  • Mark Hammond

    Mark Hammond - 2012-01-28

    I can't reproduce this, but I've assigned it to Jason who might have some insights (and sorry for the delay!)

     
  • Mark Hammond

    Mark Hammond - 2012-01-28
    • assigned_to: nobody --> jaraco
     
  • Jason R. Coombs

    Jason R. Coombs - 2012-01-28

    For me also, I'm unable to reproduce. The error suggests that there is a non-standard key in the registry in the time zone definitions. I'm going to close this ticket as we're unable to reproduce.

    If this is still a problem, please re-open the ticket (or add a comment). Please also run this command and attach the resulting tz.reg file:

    reg export "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones" tz.reg

    I will analyze the file and determine if the failure is something that we can correct against.

     
  • Jason R. Coombs

    Jason R. Coombs - 2012-01-28
    • status: open --> closed-works-for-me
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks