Issue 46029: "ValueError: Invalid isoformat string" from a valid string

Issue46029

Created on 2021-12-10 03:01 by oittaa, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg408173 - (view) Author: (oittaa) * Date: 2021-12-10 03:01
Test case:

>>> import datetime
>>> datetime.datetime.fromisoformat('2021-12-10T01:00:00Z')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid isoformat string: '2021-12-10T01:00:00Z'


Basically every other programming language I tested correctly accepted this ISO/RFC3339 string as a date.
msg408212 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-12-10 15:11
fromisoformat() is only designed to parse the output of isformat().

See issue 35829 for further discussion. I'm going to close this issue as a duplicate.
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90187
2021-12-10 15:11:47eric.smithsetstatus: open -> closed

superseder: datetime: parse "Z" timezone suffix in fromisoformat()

nosy: + eric.smith
messages: + msg408212
resolution: duplicate
stage: resolved

2021-12-10 03:01:19oittaacreate