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

Package not compatible with next version of tzlocal #191

Open
pganssle opened this issue Sep 21, 2020 · 1 comment
Open

Package not compatible with next version of tzlocal #191

pganssle opened this issue Sep 21, 2020 · 1 comment

Comments

@pganssle
Copy link

The next version of tzlocal will switch from using pytz zones to zoneinfo (which is generally a good idea), which will break this package, since zoneinfo zones don't have the same interface as pytz zones.

You should probably pin the version of tzlocal ASAP, and/or add in some logic to detect zoneinfo zones and convert them to whatever you want.

In the longer term, you should probably also migrate away from pytz and on to zoneinfo. I have a pytz-deprecation-shim module that should help ease the pain (though it is not 100% backwards compatible - in the migration guide you'll find that the semantics of datetime addition are slightly different).

@KPrasch
Copy link

KPrasch commented Oct 1, 2020

Possibly related - I just updated tzlocal to version 3.0b1 and am not able to use the .local_datetime() method producing:

>>> import maya
>>> now = maya.now()
>>> now.local_datetime()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kieran/.local/share/virtualenvs/nucypher-9CH2v_st/lib/python3.8/site-packages/maya/core.py", line 267, in local_datetime
    return self.datetime(to_timezone=self.local_timezone, naive=False)
  File "/home/kieran/.local/share/virtualenvs/nucypher-9CH2v_st/lib/python3.8/site-packages/maya/core.py", line 182, in local_timezone
    if self._local_tz.zone in pytz.all_timezones:
AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'
    @property
    def local_timezone(self):
        """Returns the name of the local timezone."""
>       if self._local_tz.zone in pytz.all_timezones:
E       AttributeError: 'backports.zoneinfo.ZoneInfo' object has no attribute 'zone'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants