Open hvdklauw opened 1 year ago
Seeing the same error. For now, pinning the version to 2.0.0.
It looks like the logic was if no known timezone, then encode the timezone as a UTC offset. I'm not sure what the correct equivalent behaviour should be. What are the timezone settings you are using?
According to sentry obj is: datetime.datetime(2023, 6, 20, 14, 23, 1, 599274, tzinfo=<DstTzInfo 'Europe/Amsterdam' CEST+2:00:00 DST>)
import datetime
import pytz
eu_ams = pytz.timezone('Europe/Amsterdam')
obj = eu_ams.localize(datetime.datetime(2023, 6, 20, 14, 23, 1, 599274))
Gives me a datetime object as given there.
Now obj.tzinfo.utcoffset
expects a datetime as parameter, passing in None there returns None.
The correct way would be:
obj.tzinfo.utcoffset(obj).total_seconds()
which gives 7200.0
as is expected.
But the better way would be to just use the datetime object directly:
obj.utcoffset().total_seconds()
We had the same issue and resolved it by pinning to 2.0.0
. Is there a solution planned to fix 2.1.1
?
So, am I to understand this is fixed in 2.2.0?
On this line: https://github.com/sibson/redbeat/blame/2012b23f890ad5a25e082b03daf8a4a2a3db6536/redbeat/decoder.py#L84 with
AttributeError: 'NoneType' object has no attribute 'total_seconds'
Why would the timezone be set to a number of seconds anyway?