Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > except KeyError: print("this was not a key error?")

Reply
Thread Tools

except KeyError: print("this was not a key error?")

 
 
gert
Guest
Posts: n/a
 
      10-10-2009
http://code.google.com/p/appwsgi/sou...sgi/order.wsgi

I screwed up some sql statement

INSERT INTO orders (pid,uid,bid,time) VALUES (?,?,2,DATETIME('NOW'))",
(v['pid']),s.UID)

bid does not exist anymore, but why does the KeyError exception occur
when only my sql statement is wrong ?
 
Reply With Quote
 
 
 
 
Michel Alexandre Salim
Guest
Posts: n/a
 
      10-11-2009
On Oct 10, 7:59*pm, gert <(E-Mail Removed)> wrote:
> http://code.google.com/p/appwsgi/sou...sgi/order.wsgi
>
> I screwed up some sql statement
>
> INSERT INTO orders (pid,uid,bid,time) VALUES (?,?,2,DATETIME('NOW'))",
> (v['pid']),s.UID)
>
> bid does not exist anymore, but why does the KeyError exception occur
> when only my sql statement is wrong ?


Sure it's not from this line?

def stats2(db,v,s): db.execute("SELECT * FROM orders WHERE bid=? AND
uid=?",(v['bid'],s.UID))

It references v['bid']

 
Reply With Quote
 
 
 
 
gert
Guest
Posts: n/a
 
      10-11-2009
On Oct 11, 7:48*am, Michel Alexandre Salim
<(E-Mail Removed)> wrote:
> On Oct 10, 7:59*pm, gert <(E-Mail Removed)> wrote:
>
> >http://code.google.com/p/appwsgi/sou...sgi/order.wsgi

>
> > I screwed up some sql statement

>
> > INSERT INTO orders (pid,uid,bid,time) VALUES (?,?,2,DATETIME('NOW'))",
> > (v['pid']),s.UID)

>
> > bid does not exist anymore, but why does the KeyError exception occur
> > when only my sql statement is wrong ?

>
> Sure it's not from this line?
>
> def stats2(db,v,s): db.execute("SELECT * FROM orders WHERE bid=? AND
> uid=?",(v['bid'],s.UID))
>
> It references v['bid']


Hmm that is also a key error
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: What is the difference between 'except IOError as e:' and 'except MRAB Python 0 11-18-2009 02:52 AM
What is the difference between 'except IOError as e:' and 'except Peng Yu Python 1 11-18-2009 02:38 AM
try -> except -> else -> except? David House Python 2 07-06-2009 05:48 PM
who is simpler? try/except/else or try/except Fabio Z Tessitore Python 5 08-13-2007 12:52 AM
converting a nested try/except statement into try/except/else John Salerno Python 20 08-11-2006 02:48 PM



Advertisments