SQLlite date time error with web.py

64 views
Skip to first unread message

Erik Martinson

unread,
Nov 26, 2012, 9:30:30 PM11/26/12
to we...@googlegroups.com
I have been racking my brain trying to figure this out. I have 4 computers that I am testing this code on. 3 fail every time with the same error. The fourth does not get an error but as far as I can tell, it is not calling the offending def. I understand the technical error, python can not convert "21 01:47:43" to an int. I can not figure out what is happening between the last to trace backs. "File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py", line 587, in _db_execute out = cur.execute(query, params)" and "File "C:\Python27\lib\sqlite3\dbapi2.py", line 63, in convert_date return datetime.date(*map(int, val.split("-")))".

On the computer what works, I edited dbapi2.py and added the command 'burp' on line 63 witch should throw another error. Nada. This tells me that on the computer that works, whatever is happening between the two last trace lines is not calling 'convert_date'.

All 4 four computers are running python 2.7.3 with web.py 0.37

The project and db are here in my dropbox.

Thanks,

Erik


Here is the error
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\application.py",  line 239, in process return self.handle()
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\application.py",  line 230, in handle return self._delegate(fn, self.fvars, args)
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\application.py",  line 420, in _delegate return handle_class(cls)
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\application.py",  line 396, in handle_class return tocall(*args)
  File "code.py", line 24, in GET  todos = db.select('todo')
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py", line 682, in select return self.query(qout, processed=True)
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py", line 1030, in query out = DB.query(self, *a, **kw)
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py", line 644, in query self._db_execute(db_cursor, sql_query)
  File "C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py", line 587, in _db_execute out = cur.execute(query, params)
  File "C:\Python27\lib\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:2214 - - [26/Nov/2012 18:12:05] "HTTP/1.1 GET /" - 500 Internal Server  Error

Erik Martinson

unread,
Nov 28, 2012, 9:15:17 PM11/28/12
to we...@googlegroups.com
I am trying to figure out what is happening by editing test db.py (C:\Python27\lib\site-packages\web.py-0.37-py2.7.egg\web\db.py). I need help figuring out why these two print statements are either (1) bank or (2) ignored.

Thanks,

Erik

        try:
            a = time.time()
            query, params = self._process_query(sql_query)
            print params        # <- This line and the next does not print on the trace
            print query           # <- Does not print
            out = cur.execute(query, params)   # <- This is where the error is
            b = time.time()

sni

unread,
Dec 6, 2012, 6:49:23 PM12/6/12
to we...@googlegroups.com
Hi Erik,

try web.debug(params).
print - see default error log
Reply all
Reply to author
Forward
0 new messages