Search Postgresql Archives

Re: execute pg_dump via python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Garry Saddington wrote:
I am using zope on windows with an external python method to backup my database. I am struggling to run the following command:

pg_dump.exe database > file

I have tried using os.popen - no luck
and also subprocess.Popen.

eg:
import subprocess
subprocess.Popen(['c:/dir/dir/pg_dump.exe','database','>','c:/dir/dir/output file'])

The command string works perfectly in a terminal. Does anyone know how I should be doing this? I get no errors or traceback when I try the method through Zope.

regards
garry

the redirect operation '>' is done by cmd.exe. I assume popen is directly spawing pg_dump, but pg_dump does not know the command line argument >.

you need to run:  'cmd.exe /c pg_dump database > out.txt'

(is it /c or /k, I always get them confused)

-Andy

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux