has2k1 / mizani

A scales package for python
https://mizani.readthedocs.io
BSD 3-Clause "New" or "Revised" License
49 stars 14 forks source link

Bug with datetime values in `timezone.utc` #30

Closed ajmarks closed 1 year ago

ajmarks commented 1 year ago

The changes at https://github.com/has2k1/mizani/commit/bee89773c11283df63a845feeb809982c0c8578d cause a ValueError (at mizani/utils.py:360) when with datetimes using timezone.utc. Repro:

from datetime import datetime, timezone
from mizani.utils import get_timezone

dt = datetime.now(tz=timezone.utc)
get_timezone([dt])
repnant commented 1 year ago

Adding a fuller error message, as this was an extremly frustratingly non-google-able-bug, and it took me way too long too figure out that I needed to demote mizani to 0.8.1 when using plotnine

... mizani/utils.py", line 360, in get_timezone
    raise ValueError(f"Unrecognised timezone class {info.__class__}")
ValueError: Unrecognised timezone class <class 'datetime.timezone'>
has2k1 commented 1 year ago

Fix has been released in mizani-0.9.2. Now on pypi and conda.