When attempting to get a time using mktime, I get a overflow exception. This occurs on a Debian docker image, but not on my host machine:
docker pull python:3.9.7
pytz==2021.3
Here's a toy example:
import datetimeimport timeimport pytzts = 1655043357tz = 'Canada/Eastern'utc_time = datetime.datetime.now(tz=pytz.utc)tz = pytz.timezone(tz)tz_aware = datetime.datetime.now(tz=tz)time.mktime(utc_time.timetuple()) # No exceptiontime.mktime(tz_aware.timetuple()) # <----Results in exception
Exception:
Traceback (most recent call last): File "/home/toy_example.py", line 15, in <module> time.mktime(tz_aware.timetuple())OverflowError: mktime argument out of range
There is no exception when running on my host machine and works as expected. Any idea why that's happening?