Better error handling if pytz is missing
See original GitHub issueSee https://github.com/closeio/ciso8601/issues/18
We should probably do a better job at failing in https://github.com/closeio/ciso8601/blob/master/module.c#L245
<del>I think right now it leaves pytz_fixed_offset
and pytz_utc
uninitialized, which is bad.</del> (it’s a global, so it’s NULL by default)
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Timezone Information Missing in pytz? - Stack Overflow
I had a similar exception UnknownTimeZoneError: Can not find any timezone configuration when i tried ... Look into pytz/init.py and see if your...
Read more >[Fixed] ModuleNotFoundError: No module named 'pytz' - Finxter
Quick Fix: Python raises the ImportError: No module named 'pytz' when it cannot find the library pytz . The most frequent source of...
Read more >ModuleNotFoundError: No module named 'pytz' in Python
The Python "ModuleNotFoundError: No module named 'pytz'" occurs when we forget to install the pytz module before importing it or install it in...
Read more >PYTZ 2022.2 Update Issues #94 - GitHub
A working fix would be to simply catch the exception and ignore it when building the list, and then confirm that the list...
Read more >pytz · PyPI
This library allows accurate and cross platform timezone calculations using Python 2.4 or higher. It also solves the issue of ambiguous times at...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Currently, it’s parsing but ignoring timezone information if pytz is not available. So you get a valid date back, but it’s just wrong. This was a nasty bug to track down. On one system it was working fine, the other it wasn’t with the same dates. Thought I was going mental.
@dahlia If ciso8601 was written at the Python level (and not the C-API level), then we could make use of
datetime.timezone
and drop the dependency on pytz for Python 3.2+.However,
datetime.timezone
objects are not exposed to the C-API until Python 3.7 😢 . Sociso8601
still requirespytz
for all current versions of Python.I will make the change to have it raise an
ImportError
if someone tries to parse an aware timestamp withparse_datetime()