Timetuple or local time gives error before 1970.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
PyEphem |
Won't Fix
|
Medium
|
Brandon Rhodes |
Bug Description
I have been searching down a particular event on the moon. (Observation of Plato's hook). It is a shadow that only appears infrequently. In order to test my search program, I needed to search a period in 1952. I was using the timetuple (as shown in the datetime object in the pyephem directions. timetuple=
C:/Python25/
Traceback (most recent call last):
File "L:/Python_
local = localtime(
File "C:\Python25\
timetuple = time.localtime(
ValueError: (22, 'Invalid argument')
here are lines 25-27
timetuple=
All of these lines work fine with a value of 1970 or higher.
John
The exception is a limitation of your operating system — when PyEphem asks it to convert the given UTC date and time into a local date and time, it finds the date too far in the past or future to represent under your operating system, and gives up.
Strictly speaking, of course, asking about the "local time" of an event too far in the past is meaningless, because time zones didn't exist until recently, and before that there was no strict definition of your location's "local time" to use. :-) But you're probably doing early-twentieth -century calculations to which such a complaint doesn't apply: time zones certainly existed then, your computer operating system just can't think about times that long ago.
I'll look around at the available time libraries for Python, and at least add to the docs a discussion of how to use one of them to do this calculation.