当给定0时,Python 3.6 datetime.fromtimestamp引发错误 [英] Python 3.6 datetime.fromtimestamp throws error when given 0
本文介绍了当给定0时,Python 3.6 datetime.fromtimestamp引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Python 3.5.2中有效:
In Python 3.5.2 this works:
datetime.datetime.fromtimestamp(0)
returns -> datetime.datetime(1970, 1, 1, 1, 0)
在Python 3.6中,我get
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.0仅在Windows上。
详细信息: https://bugs.python.org/issue29097
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.
这篇关于当给定0时,Python 3.6 datetime.fromtimestamp引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文