Quantcast
Viewing all articles
Browse latest Browse all 1268

Python • Why does datetime.fromisoformat fail on rpi, but works on windows?

I am processing data from a website API, there is an isoformat datetime field.

The little program below works on windows and fails on Raspberry pi. It is a valid iso format string. Why is it failing?
More important, how do I fix it?

Code:

from datetime import datetimexx = datetime.fromisoformat('2023-11-18T22:47:10Z')print(xx)
on a pi this fails:

Code:

Python 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] on linuxType "help", "copyright", "credits" or "license" for more information.>>> from datetime import datetime>>>xx=datetime.fromisoformat('2023-11-18T22:47:10Z')Traceback (most recent call last):  File "<stdin>", line 1, in <module>ValueError: Invalid isoformat string: '2023-11-18T22:47:10Z'

Statistics: Posted by pootle — Wed Jan 03, 2024 3:21 pm



Viewing all articles
Browse latest Browse all 1268

Trending Articles