You want to do something like this:
try:
cursor.execute("select 1 / 0 from dual")
except cx_Oracle.DatabaseError, e:
print "Exception:", e # this is what you are looking at right now
errorObj, =3D e.args # this is the actual "error" that cx_Oracle =
raises
print "ErrorCode:", errorObj.code
print "ErrorMessage:", errorObj.message
Hope that helps.
On 10/24/05, Mark Harrison <mh...@pi...> wrote:
> Right now I'm doing this, which works but seems a bit fragile.
> Is there a better way to do this?
>
> try:
> conn =3D cx_Oracle.connect(user, passwd, connurl)
> except cx_Oracle.DatabaseError, e:
> oranum=3Dstr(e).split(':')[0]
> print 'oranum=3D/%s/'%(oranum)
>
> oranum=3D/ORA-01017/
>
> Many TIA!
> Mark
>
> --
> Mark Harrison
> Pixar Animation Studios
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> cx-oracle-users mailing list
> cx-...@li...
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
|