I am using exception handling in python-2.7. I am getting exception message like UNIQUE constraint failed: table.name but someone tell me how to get exception error code like 3 /* Access permission denied */?
try:
cur.execute("INSERT INTO `table` ('name','contact') VALUES(?,?)",
('name', 'contact',))
con.commit()
except Exception as ex:
print str(ex)