Open kseistrup opened 7 years ago
The peculiar zero-padding of the months in conversion_table
only works because we're talking months before August. Because of the initial 0
the number is taken as an octal by Python 2. The Python 2 octal 01
is 0o1
or 0o01
in Python 3.
Had the IERS decided to put leap seconds in August or September, the current code would also have failed in Python 2:
>>> from datetime import datetime
>>> datetime(1972, 08, 1)
File "<stdin>", line 1
datetime(1972, 08, 1)
^
SyntaxError: invalid token
The "new" octal syntax is supported by Python 2.7 as well. So if that value is meant to be octal, please use the 0o
syntax.
Either way, this issue makes this library completely useless for Python 3, and it's the only one I know of for the task.
Is this module meant for Python 2 or Python 3? With Python 3 I get this exception: