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

DeprecationWarning: datetime.datetime.utcnow() in auth.py line 625 in Python 3.12 #3374

Closed
1 task
dutch-arrow opened this issue Feb 4, 2025 · 3 comments
Closed
1 task
Assignees
Labels
bug This issue is a confirmed bug. duplicate This issue is a duplicate. p3 This is a minor priority issue

Comments

@dutch-arrow
Copy link

Describe the bug

When using botocore 1.36.12 I get a DepricationWarning from Python 3.12.

 DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    datetime_now = datetime.datetime.utcnow()

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

No DepricationWarning

Current Behavior

When using botocore 1.36.12 I get a DepricationWarning from Python 3.12.

 DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    datetime_now = datetime.datetime.utcnow()

Reproduction Steps

Execute python statement: psycopg.connect()

Possible Solution

Change datetime.datetime.utcnow() statement in datetime.datetime.now(datetime.UTC)

Additional Information/Context

No response

SDK version used

1.36.12

Environment details (OS name and version, etc.)

Python 3.12

@dutch-arrow dutch-arrow added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Feb 4, 2025
@andrew-parsons-janus
Copy link

This is already tracked in boto/boto3#3889

@RyanFitzSimmonsAK RyanFitzSimmonsAK self-assigned this Feb 4, 2025
@RyanFitzSimmonsAK RyanFitzSimmonsAK added duplicate This issue is a duplicate. p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Feb 4, 2025
@RyanFitzSimmonsAK
Copy link
Contributor

Hi @dutch-arrow, thanks for reaching out. As @andrew-parsons-janus mentioned, this issue is being tracked in boto/boto3#3889. The tracking issue contains workarounds that might work for you. As mentioned in a related PR,

Unfortunately, this isn't as straight forward as replacing a function call. We already attempted this in 96ca907 when 3.12 support was released and needed to roll it back due to breaking date serialization changes.

We're currently looking at removing the warnings long term in a backwards compatible manner, but don't have a timeline to provide. The utcnow deprecation is currently slated sometime after Python 3.16, so it's at least few years out. We'll work on getting it addressed more timely.

Closing this as a duplicate.

Copy link

github-actions bot commented Feb 4, 2025

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. duplicate This issue is a duplicate. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants