I have a large database that I am loading into an in-memory cache. I have a process that does this iterating through the data day by day.
Recently this process has started throwing the following error:
OverflowError: date value out of range
for the line
start_day = start_day - datetime.timedelta(days = 1)
This is running in Python 3.4.3 on Ubuntu 14.04.5
You have reached datetime.date.min
, or the first of January of the year 1:
>>> from datetime import date, timedelta
>>> date.min
datetime.date(1, 1, 1)
>>> date.min - timedelta(days=1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: date value out of range
If you started at datetime.date.today()
, then it took your code a little over 736k steps to get there:
>>> date.today().toordinal()
736766
Your code probably has a bug somewhere that is subtracting too often.
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