I am trying to allow the user of my script to prompt users to enter the correct password if they have entered an invalid one. I am not sure whether this a psql configuration or if its done by using error handling with python. Which one do I use and how? My current code is as follows:
backup_ps = subprocess.Popen(
['pg_dump','-h', ORIGIN_DB, '-U', ORIGIN_DB_USER, ORIGIN_DB_NAME, '-f', destination, '-c',
'-t', 'table1',
'-Fp', '--inserts'],
stdout=subprocess.PIPE
)
output = backup_ps.communicate()[0]
# if password incorrect, prompt for correct password.