<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks. Yes, 2.4 for Win. <br>
<br>
Now to find out if the fellow who wrote the s/w package I'm writing a
utility for can move his s/w to 2.4. <br>
<br>
Martin Walsh wrote:
<blockquote cite="mid:48C9B39C.9010701@mwalsh.org" type="cite">
<pre wrap="">Wayne Watson wrote:
</pre>
<blockquote type="cite">
<pre wrap="">This program segment allows an invalid date to go undetected. See below.
def set_time_stamp(d1):
# yyyy/mm/dd hh:mm:ss in, vyyyymmdd_hhmmss.27 out
formatin = '%Y/%m/%d %H:%M:%S'
d1 = d1.lstrip()
try:
date1 = datetime(*(time.strptime(d1, formatin)[0:6]))
except ValueError:
print; print "Invalid date input. Use yyyy/mm/dd hh:mm:ss."
return False
</pre>
</blockquote>
<pre wrap=""><!----><snip>
</pre>
<blockquote type="cite">
<pre wrap=""> Enter date and time: 2008/1/100:00:30 <- Why is this valid. The
fields are not spearated.
dout: 20080110_000030
prefix: v20080110_000030.27
OK: v20080110_000030.27
</pre>
</blockquote>
<pre wrap=""><!---->
I have confirmed there is a difference in the behavior of time.strptime
between python 2.4 and 2.5, and I assume you're using 2.4.
It is possibly related to this bug (but hard to say for sure without
looking at the source)...
<a class="moz-txt-link-freetext" href="http://bugs.python.org/issue1340337">http://bugs.python.org/issue1340337</a>
... and the subsequent fix for 2.5. But, clearly something changed
between releases.
from <a class="moz-txt-link-freetext" href="http://www.python.org/download/releases/2.5/NEWS.txt">http://www.python.org/download/releases/2.5/NEWS.txt</a>
"""
- Bug #1340337: change time.strptime() to always return ValueError when
there is an error in the format string.
- Bug #1290505: Fix clearing the regex cache for time.strptime().
"""
HTH,
Marty
_______________________________________________
Tutor maillist - <a class="moz-txt-link-abbreviated" href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html;" http-equiv="Content-Type">
<title>Signature.html</title>
<pre class="moz-signature" cols="76"> Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
<font color="#330099">
</font> "If voting made any difference they wouldn't let us do it."
-- Mark Twain
Web Page: <<a class="moz-txt-link-abbreviated" href="http://www.speckledwithstars.net/">www.speckledwithstars.net/</a>></pre>
</div>
</body>
</html>