Pyrrha-Platform / Pyrrha-Rules-Decision

The Pyrrha (created by Prometeo) solution application for determining thresholds in toxin exposure measured by the sensor device and sent to the cloud from the smartphone carried by the firefighters.
Apache License 2.0
6 stars 4 forks source link

'Only timezones from the pytz library are supported' error #51

Closed upkarlidder closed 2 years ago

upkarlidder commented 2 years ago

Is your feature request related to a problem? Please describe. The code suddenly started reporting

INFO:core_decision_flask_app.py:starting application
WARNING:GasExposureAnalytics.py:prometeo_config.json : One or more of the 'gas_limits' configurations [8, 6, 4, 2, 1] is very close to the range of the 'nitrogen_dioxide' sensor (min: 0.05, max: 10).
Sensors shoud have a much larger range than the limits - e.g. 2x at a minimum .
Traceback (most recent call last):
  File "core_decision_flask_app.py", line 76, in <module>
    scheduler.add_job(func=callGasExposureAnalytics, trigger="interval", seconds=ANALYTICS_FREQUENCY_SECONDS)
  File "/usr/local/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 420, in add_job
    'trigger': self._create_trigger(trigger, trigger_args),
  File "/usr/local/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 921, in _create_trigger
    return self._create_plugin_instance('trigger', trigger, trigger_args)
  File "/usr/local/lib/python3.7/site-packages/apscheduler/schedulers/base.py", line 906, in _create_plugin_instance
    return plugin_cls(**constructor_kwargs)
  File "/usr/local/lib/python3.7/site-packages/apscheduler/triggers/interval.py", line 38, in __init__
    self.timezone = astimezone(timezone)
  File "/usr/local/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

The problem is captured in this stackoverflow question.

The tzlocal library switched from pytz to zoneinfo timezones in 3.0 and APScheduler 3.x is not compatible with those. Due to this, APScheduler 3.7.0 has tzlocal pinned to v2.x. If you're getting tzlocal 3.0 installed through APScheduler, you're using an old version. Please upgrade.

Describe the solution you'd like Update APScheduler to 3.7.0.

Describe alternatives you've considered N/A

Additional context N/A

FYI @krook