Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to 2.1.1 from 2.0.0 now it fails to run. #251

Open
hvdklauw opened this issue Jun 20, 2023 · 6 comments
Open

Updated to 2.1.1 from 2.0.0 now it fails to run. #251

hvdklauw opened this issue Jun 20, 2023 · 6 comments

Comments

@hvdklauw
Copy link

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?

@rafaelquintanilha
Copy link

Seeing the same error. For now, pinning the version to 2.0.0.

@sibson
Copy link
Owner

sibson commented Jun 21, 2023

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?

@hvdklauw
Copy link
Author

According to sentry obj is: datetime.datetime(2023, 6, 20, 14, 23, 1, 599274, tzinfo=<DstTzInfo 'Europe/Amsterdam' CEST+2:00:00 DST>)

@hvdklauw
Copy link
Author

hvdklauw commented Jul 3, 2023

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()

@hbradlow
Copy link

We had the same issue and resolved it by pinning to 2.0.0. Is there a solution planned to fix 2.1.1?

@hvdklauw
Copy link
Author

hvdklauw commented Feb 6, 2024

So, am I to understand this is fixed in 2.2.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants