regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
185 stars 58 forks source link

skip empty Time Zones registry key #15

Closed hustbeta closed 9 years ago

hustbeta commented 10 years ago

Using get_localzone() on one of my Win2003 node, I got an exception:

>>> tzlocal.get_localzone()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "...\site-packages\tzlocal\win32.py", line 82, in get_localzone
  File "...\site-packages\tzlocal\win32.py", line 56, in get_localzone_name
KeyError: 'Std'

By quickly scanning my registry keys, I found that some of the Time Zones keys are empty. They are:

I guess the most straight forward way dealing with the problem is just skip these keys, right?