postgresql - How to catch specific Postgres exceptions in Python psycopg2 -


default psycopg2 error messages broad. of time throws:

psycopg2.operationalerror

without additional information. hard guess, real reason of error - either incorrect user credentials, or fact server not running. so, need more appropriate error handling, error codes in pymysql library.

i've seen this page, not help. when do

except exception err:     print(err.pgcode) 

it prints none. , errorcodes undefined. tried import it, failed. so, need help.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -