Web app is breaking on the following line;
start_time = int(time.mktime(start)) * 1000
The error is a TypeError - argument must be 9-item sequence, not datetime.datetime
How to I convert my datetime.datetime to a 9-item-sequence?
Instead of passing datetime
object directory, use datetime.timetuple
method:
>>> int(time.mktime(start)) * 1000
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: argument must be 9-item sequence, not datetime.datetime
>>> int(time.mktime(start.timetuple())) * 1000
1406215043000L
BTW, if you use Python 3.3+, you don't need to use time.mktime
. Use datetime.timestamp
:
>>> start.timestamp()
1406215043.0
>>> int(start.timestamp()) * 1000
1406215043000
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