On Sat, Sep 28, 2013 at 01:22:26PM +0400, Oleg Broytman <p...@phdru.name> wrote: > I returned from the vacation. Will test if psycopg w/o SQLObject > returns the code/error.
The following program: from decimal import Decimal import psycopg2 def report_error(e): print e.__class__.__name__, e.pgcode, e.pgerror raise SystemExit try: con = psycopg2.connect(database="test") except psycopg2.Error, e: report_error(e) cur = con.cursor() try: cur.execute('SELECT * FROM test ORDER BY id') except psycopg2.Error, e: report_error(e) prints OperationalError None None when it cannot connect to the database and prints ProgrammingError 42P01 ERROR: relation "test" does not exist when the database exists but there is no table "test". I.e., psycopg2 doesn't return proper code/message for an OperationalError, so your original request cannot be fullfilled, alas. You can ask psycopg2 authors if they are going to fix that. I will do more tests and include the code into the next release. I hope to release SQLObject 1.5 RSN. Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss