s3fs icon indicating copy to clipboard operation
s3fs copied to clipboard

Python3≥3.12 Deprecated datatime.utcnow()

Open realzhipeng opened this issue 6 months ago • 2 comments

Hello,

When use it in python3.12, and 3.13, I meet "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)."

I checked the https://docs.python.domainunion.de/3/library/datetime.html, they told me that this function is not present anymore. could you update the package?

realzhipeng avatar Jul 21 '25 12:07 realzhipeng

See https://github.com/fsspec/gcsfs/pull/683/files for a fix. However, note that comparisons with TZ-free times will require careful consideration. Do you have the time to fix?

martindurant avatar Jul 21 '25 13:07 martindurant

Actually, I don't see where in s3fs utcnow is being used. Can you show the whole exception or warning you are seeing?

martindurant avatar Jul 21 '25 13:07 martindurant