datetime parse fails in app engine, runs fine in python

15 views
Skip to first unread message

thedude

unread,
Aug 23, 2008, 2:08:59 PM8/23/08
to Google App Engine
i'm parsing some strings posted into the app into datetime.

hardcoded the entry to debug, running this in python directly works
fine:

>>> datetime.strptime("Fri Aug 22 17:13:14 PDT 2008", "%a %b %d %H:%M:%S %Z %Y")
datetime.datetime(2008, 8, 22, 17, 13, 14)

in my app engine python code, hardcoding the same line, the following
failure to parse occurs:

ERROR 2008-08-23 18:04:19,026 __init__.py] Traceback (most recent
call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/
GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/
google/appengine/ext/webapp/__init__.py", line 501, in __call__
handler.post(*groups)
File "/Users/rich/dev/hoopy/hoopy.py", line 69, in post
article.articleDate = datetime.strptime("Fri Aug 22 17:13:14 PDT
2008", "%a %b %d %H:%M:%S %Z %Y")
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/_strptime.py", line 330, in strptime
(data_string, format))
ValueError: time data did not match format: data=Fri Aug 22 17:13:14
PDT 2008 fmt=%a %b %d %H:%M:%S %Z %Y


ideas?

Marzia Niccolai

unread,
Aug 25, 2008, 12:34:51 PM8/25/08
to google-a...@googlegroups.com
This seems to be unhappy with the timezone.  In the datastore we only allow UTC times, but I'm not certain if or how this applies to creating datetime objects.  More investigation is needed.

-Marzia
Reply all
Reply to author
Forward
0 new messages