regebro / tzlocal

A Python module that tries to figure out what your local timezone is
MIT License
184 stars 58 forks source link

TypeError: Only timezones from the pytz library are supported #97

Closed SergeyPirogov closed 3 years ago

SergeyPirogov commented 3 years ago

Version 3b1 fails with error below:

  File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 420, in add_job
    'trigger': self._create_trigger(trigger, trigger_args),
  File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 921, in _create_trigger
    return self._create_plugin_instance('trigger', trigger, trigger_args)
  File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 906, in _create_plugin_instance
    return plugin_cls(**constructor_kwargs)
  File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/triggers/interval.py", line 38, in __init__
    self.timezone = astimezone(timezone)
  File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/util.py", line 93, in astimezone
    raise TypeError('Only timezones from the pytz library are supported')
TypeError: Only timezones from the pytz library are supported

Rollback to version 2.1 fixes this

regebro commented 3 years ago

Ah, yes, that's pretty expected. Can you show a few lines of code, so I know how you use this? That would be helpful.

Version 3 at the moment by default do not return pytz timezones, but since it only supports Python 3 it can now switch to using the built in timezones in Python 3.

SergeyPirogov commented 3 years ago

I use apscheduler. And from error above you can see that it fails internaly in File "/home/sergey/PycharmProjects/mitm_proxy/venv/lib/python3.7/site-packages/apscheduler/util.py", line 93,

regebro commented 3 years ago

Aha: https://github.com/agronholm/apscheduler/issues/461

agronholm commented 3 years ago

This should be closed now that the downstream problem has been fixed in a released version.