You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
Accessing blob.custom_time errors on 0 microsecond timestamp #363
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/google/cloud/storage/blob.py", line 3773, in custom_time
return _rfc3339_to_datetime(value)_rfc3339_to_datetime
File "/usr/local/lib/python3.7/site-packages/google/cloud/_helpers.py", line 286, in _rfc3339_to_datetime
return datetime.datetime.strptime(dt_str, _RFC3339_MICROS).replace(tzinfo=UTC)
File "/usr/local/lib/python3.7/_strptime.py", line 577, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/local/lib/python3.7/_strptime.py", line 359, in _strptime
(data_string, format))
ValueError("time data '2000-01-13T13:01:00Z' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'")
Thank you for filing this issue. I was able to reproduce it and looks like Cloud Storage returns no fractional microsecond when it's 0 even though the format described in documentation is YYYY-MM-DD'T'HH:MM:SS.SS'Z'.
The issue with the client is that it always expects the returned value to include microseconds. I'm following up with the backend team to understand if this is the expectation.
I'll loop back when I learn more. Thank you for your patience!
This is a bug in the library. The Storage backend team stated that when milliseconds is 0 the 0 is not returned.
I'll work on a fix this week. It will require two PRs based on my current understanding, there might be a better solution though and will research / update:
Activity
frankyn commentedon Jan 25, 2021
Hi @rconnaughton,
Thank you for filing this issue. I was able to reproduce it and looks like Cloud Storage returns no fractional microsecond when it's 0 even though the format described in documentation is
YYYY-MM-DD'T'HH:MM:SS.SS'Z'.The issue with the client is that it always expects the returned value to include microseconds. I'm following up with the backend team to understand if this is the expectation.
I'll loop back when I learn more. Thank you for your patience!
frankyn commentedon Feb 1, 2021
This is a bug in the library. The Storage backend team stated that when milliseconds is 0 the 0 is not returned.
I'll work on a fix this week. It will require two PRs based on my current understanding, there might be a better solution though and will research / update:
fix: custom_time decoding without microseconds
fix: correctly decode times without microseconds
fix: correctly decode times without microseconds (#375)
fix: correctly decode times without microseconds (googleapis#375)
fix: correctly decode times without microseconds (googleapis#375)