This is the python script that gives the error:
>>> import time
>>> t=[ ]
>>> t.append(time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0,tm_min=0,tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: structseq() takes at most 2 arguments (9 given)
This one also gives the same error:
>>> import time
>>> t=time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0,tm_min=0,tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: structseq() takes at most 2 arguments (9 given)
time.struct_time
expects its first argument to be a sequence with 9 elements:
In [58]: time.struct_time((2000,11,30,0,0,0,3,335,-1))
Out[58]: time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1)
But note that this overspecifies the datetime.
For instance, you could specify Jan 1, 2000 as having tm_yday = 100
, which is clearly not true:
In [72]: time.struct_time((2000,1,1,0,0,0,3,100,-1))
Out[72]: time.struct_time(tm_year=2000, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=100, tm_isdst=-1)
Therefore, it is probably better to use a datetime and call its timetuple() method to obtain a time.struct_time:
In [70]: import datetime as dt
In [71]: dt.datetime(2000,11,30,0,0,0).timetuple()
Out[71]: time.struct_time(tm_year=2000, tm_mon=11, tm_mday=30, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=335, tm_isdst=-1)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With