Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python 3.6 datetime.fromtimestamp throws error when given 0

In Python 3.5.2 this works:

datetime.datetime.fromtimestamp(0)
returns -> datetime.datetime(1970, 1, 1, 1, 0)

In Python 3.6, however, I get

datetime.datetime.fromtimestamp(0)
-> OSError: [Errno 22] Invalid argument

I can't find any change to the function in the docs. I am curious why this breaks my scripts now and where I can find the reasons.

Can anybody shed some light on that?

Python 3.6 REPL datetime.fromtimestamp error

like image 576
Chris Avatar asked Feb 23 '17 10:02

Chris


1 Answers

It's a bug introduced in Python 3.6.0 on Windows only.
Details: https://bugs.python.org/issue29097

Patches are in the works and it will likely be fixed soon.

like image 127
leovp Avatar answered Nov 19 '22 19:11

leovp