Page 1 of 1

Stdout = outfile in subprocess.run funktioniert nicht mit der Shell pg_restore

Posted: 06 Feb 2025, 08:56
by Anonymous
Ich bin gespannt, warum die Option stdout = outfile in subprocess.run nicht mit der Shell pg_resotre funktioniert. Die Ausgabe des Shell PSQL wird jedoch tatsächlich in die von mir angegebene Ausgabedatei umgeleitet. Was habe ich verpasst?

Code: Select all

with open("stdout.log", "w") as outfile:
subprocess.run(['/usr/bin/pg_restore', '-w', '-v', '-U', user, '-h', host, '-F', 'd', '-j', '3', '-d', db, directory], stdout=outfile, text=True, env={'PGPASSFILE': pgpassfile})