> try:
> cursor.execute("select 1 / 0 from dual")
> except cx_Oracle.DatabaseError, e:
> print "Exception:", e # this is what you are looking at=20
> right now
> errorObj, =3D e.args # this is the actual "error"=20
This is overly subtle. Why not write
errorObj =3D e.args[0]
? I can't think of a situation where that wouldn't work and the former
would.
> that cx_Oracle raises
> print "ErrorCode:", errorObj.code
> print "ErrorMessage:", errorObj.message
--Guido van Rossum
|