[Tutor] Help with web.py error

eryksun eryksun at gmail.com
Wed Dec 5 09:36:30 CET 2012


On Wed, Dec 5, 2012 at 2:13 AM, Erik Martinson <eman_no1 at yahoo.com> wrote:
>
> File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date
>  return datetime.date(*map(int, val.split("-")))
>
> ValueError: invalid literal for int() with base 10: '21 01:47:43'
> 127.0.0.1:59850 - - [04/Dec/2012 22:47:35] "HTTP/1.1 GET /" - 500 Internal
> Server Error
>
> I understand the error, there is no way '21 01:47:43' can become an int.
> What I can not figure out is the correlation between the last two lines in
> the traceback. What is actually calling the last command 'datetime.date'?

See the web.py SqliteDB class:

https://github.com/webpy/webpy/blob/master/web/db.py#L1010

Notice it sets 'detect_types'. More here:

http://docs.python.org/2/library/sqlite3.html#module-functions-and-constants
http://docs.python.org/2/library/sqlite3.html#default-adapters-and-converters

The issue then is the "created" field in your todo table is type
"date", but contains a "timestamp".


More information about the Tutor mailing list