You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below is not tied to any django project, thus timezone defined should be the default value, UTC.
Pytz works, thus I'll be using it for the foreseeable future.
Here's the code related to this issue:
fromzoneinfoimportZoneInfodefnow_in_germany():
returndatetime.datetime.now(tz=ZoneInfo('Europe/Berlin'))
crontab_germany=partial(crontab, nowfun=now_in_germany)
BEAT_SCHEDULE= {
"every-minute": {
"task": "<something>",
"schedule": crontab_germany("*", "7,13", "*", "*", "*", ),
# 7AM and 1PM in german time"args": (),
},
}
Here's the traceback:
beat raised exception <class 'AttributeError'>: AttributeError("'zoneinfo.ZoneInfo' object has no attribute 'zone'")
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/celery/apps/beat.py", line 105, in start_scheduler
service.start()
File "/usr/local/lib/python3.10/site-packages/celery/beat.py", line 636, in start
humanize_seconds(self.scheduler.max_interval))
File "/usr/local/lib/python3.10/site-packages/kombu/utils/objects.py", line 30, in __get__returnsuper().__get__(instance, owner)
File "/usr/local/lib/python3.10/functools.py", line 981, in __get__
val =self.func(instance)
File "/usr/local/lib/python3.10/site-packages/celery/beat.py", line 679, in schedulerreturnself.get_scheduler()
File "/usr/local/lib/python3.10/site-packages/celery/beat.py", line 670, in get_schedulerreturn symbol_by_name(self.scheduler_cls, aliases=aliases)(
File "/usr/local/lib/python3.10/site-packages/redbeat/schedulers.py", line 377, in __init__super(RedBeatScheduler, self).__init__(app, **kwargs)
File "/usr/local/lib/python3.10/site-packages/celery/beat.py", line 271, in __init__self.setup_schedule()
File "/usr/local/lib/python3.10/site-packages/redbeat/schedulers.py", line 395, in setup_scheduleself.update_from_dict(self.app.redbeat_conf.schedule)
File "/usr/local/lib/python3.10/site-packages/redbeat/schedulers.py", line 409, in update_from_dict
entry.save() # store into redis
File "/usr/local/lib/python3.10/site-packages/redbeat/schedulers.py", line 306, in save
pipe.hsetnx(self.key, 'meta', json.dumps(meta, cls=RedBeatJSONEncoder))
File "/usr/local/lib/python3.10/json/__init__.py", line 238, in dumps**kw).encode(obj)
File "/usr/local/lib/python3.10/json/encoder.py", line 199, in encode
chunks =self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.10/json/encoder.py", line 257, in iterencodereturn _iterencode(o, 0)
File "/usr/local/lib/python3.10/site-packages/redbeat/decoder.py", line 79, in defaultelif obj.tzinfo.zone isNone:
AttributeError: 'zoneinfo.ZoneInfo' object has no attribute 'zone'
The text was updated successfully, but these errors were encountered:
PEP-615 defines a ZoneInfo class which kind of deprecates pytz in the long term.
The code below is not tied to any django project, thus timezone defined should be the default value,
UTC
.Pytz works, thus I'll be using it for the foreseeable future.
Here's the code related to this issue:
Here's the traceback:
The text was updated successfully, but these errors were encountered: