running pg_dump on windows as external method
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
--On 25. Oktober 2007 22:48:42 +0100 Garry Saddington <garry@schoolteachers.co.uk> 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/out put file'])
- play with the shell=True|False parameter of Popen() - why do you use redirection since Popen() provides a proper mechansim for reading stderr/stdout - where is your code where you are calling wait()??? Please try again... -aj
--On 25. Oktober 2007 22:48:42 +0100 Garry Saddington <garry@schoolteachers.co.uk> 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
More to the point: why are you doing this? Why not just run this as a scheduled task? cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (3)
-
Andreas Jung -
Chris Withers -
Garry Saddington