-
Notifications
You must be signed in to change notification settings - Fork 440
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
Avoid KeyError trying to get data on WindowsXP #604
Conversation
I've found this issue trying to compile documentation with Sphinx on WindowsXP with `make html` command. Some data dictionaries are void on my machine, so using lazy 'get' on those can prevent next `KeyError`: ``` C:\Path\to\my\project\doc>make html {'MapID': '8,9', 'Index': 165, 'Std': 'Hora estándar árabe', 'Display': '(GMT+04 :00) Abu Dhabi, Muscat', 'TZI': b'\x10\xff\xff\xff\x00\x00\x00\x00\xc4\xff\xff\x ff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x 00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano árab e'} {'MapID': '-1,71', 'Index': 158, 'Std': 'Hora estándar árabe D', 'Display': '(GM T+03:00) Baghdad', 'TZI': b'L\xff\xff\xff\x00\x00\x00\x00\xc4\xff\xff\xff\x00\x0 0\n\x00\x00\x00\x01\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\ x01\x00\x03\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano árabe'} {'MapID': '12,13', 'Index': 195, 'Std': 'Hora estándar de Asia C.', 'Display': ' (GMT+06:00) Astana, Dhaka', 'TZI': b'\x98\xfe\xff\xff\x00\x00\x00\x00\xc4\xff\xf f\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0 0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', 'Dlt': 'Hora de verano d e Asia C.'} {} Traceback (most recent call last): File "c:\python34\lib\runpy.py", line 170, in _run_module_as_main "__main__", mod_spec) File "c:\python34\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Python34\Scripts\sphinx-build.exe\__main__.py", line 5, in <module> File "c:\python34\lib\site-packages\sphinx\cmd\build.py", line 25, in <module> from sphinx.application import Sphinx File "c:\python34\lib\site-packages\sphinx\application.py", line 29, in <modul e> from sphinx.config import Config, check_unicode File "c:\python34\lib\site-packages\sphinx\config.py", line 28, in <module> from sphinx.util.i18n import format_date File "c:\python34\lib\site-packages\sphinx\util\i18n.py", line 20, in <module> import babel.dates File "c:\python34\lib\site-packages\babel\dates.py", line 29, in <module> from babel.util import UTC, LOCALTZ File "c:\python34\lib\site-packages\babel\util.py", line 19, in <module> from babel import localtime File "c:\python34\lib\site-packages\babel\localtime\__init__.py", line 74, in <module> LOCALTZ = get_localzone() File "c:\python34\lib\site-packages\babel\localtime\__init__.py", line 70, in get_localzone return _get_localzone() File "c:\python34\lib\site-packages\babel\localtime\_win32.py", line 97, in _g et_localzone return pytz.timezone(get_localzone_name()) File "c:\python34\lib\site-packages\babel\localtime\_win32.py", line 70, in ge t_localzone_name if data['Std'] == tzwin: KeyError: 'Std' ```
Codecov Report
@@ Coverage Diff @@
## master #604 +/- ##
=======================================
Coverage 90.31% 90.31%
=======================================
Files 24 24
Lines 4128 4128
=======================================
Hits 3728 3728
Misses 400 400
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a good patch (though Windows XP has been EOL for a while now).
I know, I don't use it to work usually, only was a small fix to make it work on my parents' PC. |
I've found this issue trying to compile documentation with Sphinx on WindowsXP with
make html
command. Some data dictionaries are void on my machine, so using lazy 'get' on those can prevent nextKeyError
: