Only timezones from the pytz library are supported

See original GitHub issue

With tzlocal==3.0b1 elastalert doesn’t work:

1 rules loaded
Traceback (most recent call last):
  File "/usr/bin/elastalert-test-rule", line 11, in <module>
    load_entry_point('elastalert==0.2.1', 'console_scripts', 'elastalert-test-rule')()
  File "/usr/lib/python3.8/site-packages/elastalert-0.2.1-py3.8.egg/elastalert/test_rule.py", line 445, in main
    test_instance.run_rule_test()
  File "/usr/lib/python3.8/site-packages/elastalert-0.2.1-py3.8.egg/elastalert/test_rule.py", line 437, in run_rule_test
    self.run_elastalert(rule_yaml, conf, args)
  File "/usr/lib/python3.8/site-packages/elastalert-0.2.1-py3.8.egg/elastalert/test_rule.py", line 307, in run_elastalert
    client = ElastAlerter(['--debug'])
  File "/usr/lib/python3.8/site-packages/elastalert-0.2.1-py3.8.egg/elastalert/elastalert.py", line 173, in __init__
    if not self.init_rule(rule):
  File "/usr/lib/python3.8/site-packages/elastalert-0.2.1-py3.8.egg/elastalert/elastalert.py", line 1031, in init_rule
    job = self.scheduler.add_job(self.handle_rule_execution, 'interval',
  File "/usr/lib/python3.8/site-packages/APScheduler-3.6.3-py3.8.egg/apscheduler/schedulers/base.py", line 420, in add_job
    'trigger': self._create_trigger(trigger, trigger_args),
  File "/usr/lib/python3.8/site-packages/APScheduler-3.6.3-py3.8.egg/apscheduler/schedulers/base.py", line 921, in _create_trigger
    return self._create_plugin_instance('trigger', trigger, trigger_args)
  File "/usr/lib/python3.8/site-packages/APScheduler-3.6.3-py3.8.egg/apscheduler/schedulers/base.py", line 906, in _create_plugin_instance
    return plugin_cls(**constructor_kwargs)
  File "/usr/lib/python3.8/site-packages/APScheduler-3.6.3-py3.8.egg/apscheduler/triggers/interval.py", line 38, in __init__
    self.timezone = astimezone(timezone)
  File "/usr/lib/python3.8/site-packages/APScheduler-3.6.3-py3.8.egg/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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:20 (11 by maintainers)

github_iconTop GitHub Comments

5reactions
ManuelFFFcommented, Sep 22, 2020

Please disregard. I tried downgrading “tzlocal” like you said (tzlocal<3.0) and that fixed the issue. ElastAlert is up and running.

Thank you

0reactions
Karlheinzniebuhrcommented, Feb 4, 2022

Same issue here

Read more comments on GitHub >

github_iconTop Results From Across the Web

'Only timezones from the pytz library are supported' error
The tzlocal library switched from pytz to zoneinfo timezones in 3.0 and APScheduler 3.x is not compatible with those.
Read more >
Working with Timezones and Python using Pytz library - Medium
Learn how to work with different timezones in a very easy and simples way using Pytz library for python.
Read more >
pytz - World Timezone Definitions for Python — pytz 2014.10 ...
This library only supports two ways of building a localized time. The first is to use the localize() method provided by the pytz...
Read more >
python Only timezones from the pytz library are supported
最近在使用测试平台时,使用到定时任务时,遇到的问题:新建失败:Only timezones from the pytz library are supported各种方法百度等,均不得其解。
Read more >
Working With TimeZones in Python - PYnative
The pytz library has implemented a timezone class for handling arbitrary fixed offsets from UTC and timezones. This library allows accurate ...
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