[英]ValueError: time data '0000-00-00 00:00:00' does not match format '%Y-%m-%d %H:%M:%S'
I am trying to convert my WordPress site to a static site generator using the program exitwp . 我正在尝试使用程序exitwp将WordPress网站转换为静态网站生成器。 But during the conversion process, I always get the following error message:
但是在转换过程中,我总是收到以下错误消息:
Traceback (most recent call last):
File "exitwp.py", line 374, in <module>
write_jekyll(data, target_format)
File "exitwp.py", line 296, in write_jekyll
i['date'], '%Y-%m-%d %H:%M:%S').replace(tzinfo=UTC()),
File "/Users/xxxxx/.pyenv/versions/2.7.10/lib/python2.7/_strptime.py", line 325, in _strptime
(data_string, format))
ValueError: time data '0000-00-00 00:00:00' does not match format '%Y-%m-%d %H:%M:%S'
I am not a Python programmer but I looked up what the time data format means and it seems to me that '0000-00-00 00:00:00' DOES MATCH the format '%Y-%m-%d %H:%M:%S'. 我不是Python程序员,但是我查询了时间数据格式的含义,在我看来'0000-00-00 00:00:00'确实匹配了格式'%Y-%m-%d%H: %女士'。
Any idea what is wrong? 知道有什么问题吗? Help would be very appreciated!
帮助将不胜感激!
%Y
matches years in the range 0001
through to 9999
, see the table in the module documentation : %Y
匹配从0001
到9999
年份,请参见模块文档中的表 :
%Y
Year with century as a decimal number.以世纪作为十进制数字的年份。
0001, 0002, …, 2013, 2014, …, 9998, 99990001,0002,…,2013,2014,…,9998,9999
Your year 0000
falls outside of that range. 您的年份
0000
不在该范围内。
The same issue applies to %m
and %d
(the acceptable ranges are 01
through to 12
, and 01
through to 31
, respectively). 相同的问题适用于
%m
和%d
(可接受的范围分别是01
到12
,以及01
到31
)。
That's because datetime.datetime()
objects have the same range for their attribute values, there is no datetime.datetime(0, 0, 0, 0, 0)
object. 这是因为
datetime.datetime()
对象的属性值具有相同的范围,所以没有datetime.datetime(0, 0, 0, 0, 0)
对象。 datetime.datetime.min
is set to datetime.datetime(1, 1, 1, 0, 0)
(so 0001-01-01 00:00:00
). datetime.datetime.min
设置为datetime.datetime(1, 1, 1, 0, 0)
0001-01-01 00:00:00
datetime.datetime(1, 1, 1, 0, 0)
(所以0001-01-01 00:00:00
)。
Presumably 0000-00-00 00:00:00
means 'no date available'; 大概
0000-00-00 00:00:00
表示“无日期可用”; you'll have to alter the input to replace those dates, or handle that value to replace it with something else (perhaps None
would be acceptable?) 您将不得不更改输入以替换那些日期,或处理该值以将其替换为其他值(也许
None
可以接受吗?)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.