question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better error handling if pytz is missing

See original GitHub issue

See 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
batkuipcommented, Jan 22, 2018

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.

1reaction
movermeyercommented, May 10, 2018

@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 😢 . So ciso8601 still requires pytz 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 with parse_datetime()

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found