2008/10/3 Chris Wood <[EMAIL PROTECTED]> > If I run a python program that calls a stored procedure without a "try:" , > I see a descriptive message in the error that is returned (highlighted > inyellowbelow): > > >>> cur.execute("select * from f_test_return_error2('normon')") > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "/usr/lib/python2.4/site-packages/psycopg2/extras.py", line 48, in > execute > return _cursor.execute(self, query, vars, async) > psycopg2.ProgrammingError: Error. Party name normon not found in the > party table. > > but if I put the "cur.execute" in a "try:" / "except:" I cannot figure out > where to get the error text that I need, > can anyone help please?? >
I don't have a PostgreSQL server handy, so this is not tested: try: cur.execute(...) except psycopg2.ProgrammingError, e: print e.message Hope this helps, -- Carsten Haese http://informixdb.sourceforge.net
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig