[Python-bugs-list] strptime error (PR#149)

python.org@netfinances.com python.org@netfinances.com
Sat, 4 Dec 1999 22:03:46 -0500 (EST)


Full_Name: Fred Fahnert
Version: 1.5.2
OS: RedHat Linux 6.0
Submission from: host162.netfinances.com (216.65.99.162)


strptime throws a ValueError exception when I feed it the hour 02, and a minute
value 
equal to 40 or greater the following session illustrates:

1017:26:fred@firestorm:~/public_html >python
Python 1.5.2 (#2, Dec  3 1999, 23:56:19)  [GCC egcs-2.91.66 19990314/Linux
(egcs- on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> from time import strptime
>>> t = strptime('0230','%H%M')
>>> t
(1900, 1, 0, 23, 0, 0, 6, 1, 0)
>>> t = strptime('0240','%H%M')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: format mismatch
>>> t = strptime('0140','%H%M')
>>> t = strptime('0340','%H%M')
>>> t = strptime('0345','%H%M')
>>> t = strptime('0339','%H%M')
>>> t = strptime('0240','%H%M')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: format mismatch
>>> t = strptime('0245','%H%M')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: format mismatch
>>> t = strptime('0250','%H%M')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: format mismatch
>>> t = strptime('0259','%H%M')
Traceback (innermost last):
  File "<stdin>", line 1, in ?
ValueError: format mismatch
>>>