running pg_dump from python

From: Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: running pg_dump from python
Date: 2009-06-14 20:06:56
Message-ID: 4A355860.1010102@schoolteachers.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I ahve the following python file that I am running as an external method
in Zope.

def backup():
import os
os.popen("c:/scholarpack/postgres/bin/pg_dump scholarpack >
c:/scholarpack/ancillary/scholarpack.sql")
data=open('c:/scholarpack/ancillary/scholarpack.sql','r')
r=data.read()
data.close
return r

However, when I run this script it creates the file scholarpack.sql but
the file is empty.
Any help much appreciated.
Regards
Garry

Responses

Browse pgsql-general by date

  From Date Subject
Next Message James B. Byrne 2009-06-14 20:09:14 Re: cygwin and postgresql
Previous Message James B. Byrne 2009-06-14 19:56:37 Re: cygwin and postgresql