python-o365: PYTZ removal causes errors in latest release
I’m trying to upgrade to the latest O365 release (2.0.31), with no changes to my code I get this error:
TypeError: timezone() argument 1 must be datetime.timedelta, not str
The call I’m making is this:
account = Account( credentials, token_backend=token_backend, timezone=("UTC"), main_resource=main_resource )
If I remove the timezone from the call:
account = Account( credentials, token_backend=token_backend, main_resource=main_resource )
I get this error:
2023-10-05 17:33:42.688 WARNING (MainThread) [py.warnings] /HADev/Hassio/dev-config/O365/utils/windows_tz.py:638: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
Is this expected, or is there a timezone parameter I can pass in which will remove the warning? I’ve tried passing in timedelta(microseconds=0) as implied in the first error, but I get the same as the second error.
It’s probably me just missing something, but I can’t see what it is.
About this issue
- Original URL
- State: closed
- Created 9 months ago
- Comments: 18 (18 by maintainers)
Commits related to this issue
- Fix issue #1011 with timezone conversion (from Windows timezones to IANA ones) using the python 3.9 ZoneInfo objects — committed to O365/python-o365 by deleted user 5 months ago
Hi, the problem is that tzlocal get_localzone() function uses PyTzDeprecationShim.
See #753