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

Fix UTC usage #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

demircancelebi
Copy link

Hello @Voyz
Thank you for ibind / ibeam. I was trying to use your library and calling ibind_logs_initialize() failed for me with:

    now = datetime.datetime.now(datetime.UTC)
AttributeError: module 'datetime' has no attribute 'UTC'

I thought this might fix it so I applied the fix: https://stackoverflow.com/a/13624191

It fixed the issue for me but I am not used to committing to Python repos so you can guide me on whether this needs further work.

Best,

@Voyz
Copy link
Owner

Voyz commented Aug 21, 2024

Hey @demircancelebi thanks for pointing this out and for your suggested fix 👍

I'm trying to debug this, what Python version are you running this on?

@@ -1,4 +1,5 @@
import datetime
from datetime import datetime, timezone
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than importing from the datetime package, can you stick to the namespace usage already present in this project? Therefore, use datetime.datetime.now, and datetime.timezone.utc, instead of datetime.now and timezone.utc. Other than that, looks good! Thanks 👍

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

Successfully merging this pull request may close these issues.

2 participants