Hi, all. When i try to insert a duplicate record, it will raise an error:
---- >>> try: >>> db.insert(xxx) >>> except Exception, e: >>> print >> sys.stderr, e (1062, "Duplicate entry 'xxx' for key 1") ---- Error code of "Duplicate entry" is MySQLdb.constants.ER.DUP_ENTRY (1062), but below code with "except ER.DUP_ENTRY" doesn't work at all: ---- >>> from MySQLdb.constants import ER ... >>> try: >>> db.insert(xxx) >>> except ER.DUP_ENTRY: >>> print >> sys.stderr, 'get exception' ---- Is there a better way to catch MySQLdb exceptions? Thanks very much. :) -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
