strptime on Unix systems

Malcolm Tredinnick malcolmt at smart.net.au
Wed Dec 22 05:27:08 EST 1999


On Wed, Dec 22, 1999 at 09:41:04AM +0000, Oleg Broytmann wrote:
> On Wed, 22 Dec 1999, Malcolm Tredinnick wrote:
> > The following does *not* work under Linux (at least):
> > 
> > import time
> > format = '%a %b %d %H:%M:%S %Z %Y'
> > t = time.localtime(time.time())
> > timestring = time.strftime(format, tt)		# Works OK
> > timetuple = time.strptime(tt, format)		# Throws ValueError
> > 
>    I've tested your program (replaced "t =" with "tt =") on pentium linux,
> freebsd and sprac solaris. All the same ValueError...

Urgh! Stupid typing error ... sorry :(

OK .. so we have three pretty common unix variants all exhibiting the same
problem. Should something be added to the docs (under strptime) about this in
the future? (I was going to mention I was running glibc 2.0, rather than the
latest 2.1 version, but that seems irrelevant if *BSD and Solaris are behaving
similarly.)

Malcolm Tredinnick





More information about the Python-list mailing list