Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gettz('') fails on windows #925

Closed
labrys opened this issue Jun 23, 2019 · 0 comments · Fixed by #1024
Closed

gettz('') fails on windows #925

labrys opened this issue Jun 23, 2019 · 0 comments · Fixed by #1024

Comments

@labrys
Copy link
Contributor

labrys commented Jun 23, 2019

Given the following (tested with Python 3.7 and dateutil 2.8.0):

import dateutil.tz
print(dateutil.tz.gettz(''))

On Linux:

None

On Windows:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "H:\src\env\desc\lib\site-packages\dateutil\tz\tz.py", line 1551, in __call__
    rv = self.nocache(name=name)
  File "H:\src\env\desc\lib\site-packages\dateutil\tz\tz.py", line 1635, in nocache
    tz = tzwin(name)
  File "H:\src\env\desc\lib\site-packages\dateutil\tz\win.py", line 223, in __init__
    self._std_abbr = keydict["Std"]
KeyError: 'Std'
@labrys labrys changed the title gettz fails on windows for empty string gettz('') fails on windows Jun 23, 2019
@pganssle pganssle added this to the Bugfix release milestone Jul 7, 2019
ffe4 added a commit to ffe4/dateutil that referenced this issue Apr 3, 2020
ffe4 added a commit to ffe4/dateutil that referenced this issue Apr 3, 2020
ffe4 added a commit to ffe4/dateutil that referenced this issue Apr 3, 2020
ffe4 added a commit to ffe4/dateutil that referenced this issue Apr 3, 2020
nocache checks the gettz(name) parameter with if not name and tries to get the local time from the TZ environment variable. When the environment variable does not exist, it only checked for name is None, skipping the logic that searches for the local time tzfile when passed an empty string.

Fixes dateutil#925, dateutil#926
ffe4 added a commit to ffe4/dateutil that referenced this issue Apr 5, 2020
nocache checks the gettz(name) parameter with if not name and tries to get the local time from the TZ environment variable. When the environment variable does not exist, it only checked for name is None, skipping the logic that searches for the local time tzfile when passed an empty string.

Fixes dateutil#925, dateutil#926
pganssle pushed a commit to ffe4/dateutil that referenced this issue Apr 24, 2020
The documented behavior of the function is to return a local time zone
when the argument is None or an empty string.

This was working if the TZ environment variable was set, but not working
otherwise.

Fixes dateutil#925, dateutil#926
pganssle pushed a commit to ffe4/dateutil that referenced this issue Apr 24, 2020
The documented behavior of the function is to return a local time zone
when the argument is None or an empty string.

This was working if the TZ environment variable was set, but not working
otherwise.

Fixes dateutil#925, dateutil#926
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants