Causing Guido van Rossum to asktry: 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, = e.args # this is the actual "error" that cx_Oracle raises print "ErrorCode:", errorObj.code print "ErrorMessage:", errorObj.message
This is overly subtle. Why not writeand received the responseerrorObj = e.args
No particularly good reason -- it just happens to be a way of indicating that there should be one and only one entry in the list. An exception is raised if there is not whereas args does not raise the exception. Its an open question which is the better code.