[Zope] external method

Garry Saddington garry at schoolteachers.co.uk
Mon Jun 15 16:40:26 EDT 2009


I have the following external method to back up a postgres database, 
using the following software versions.
Zope Version
	
(Zope 2.9.0, python 2.4.2, win32)
Python Version
	
2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)]
System Platform
	
win32

Zope is running as user scholarpack who is an administrator on win 
server 2008.
/
import  subprocess

def backup():
    try:
            p=subprocess.Popen("c:/scholarpack/postgres/bin/pg_dump 
scholarpack",shell=True,stdout=subprocess.PIPE)
            data=p.communicate()[0]
        
            f=open('c:/scholarpack/ancillary/scholarpack.sql','w')
            w=f.write(data)
            f.close()
    except OSError:
           print "There was a problem opening the file for writing"


/When I run this through Zope I get an empty file. There are no errors 
reported. However, if I use the same python that is running zope in an 
interactive shell and run these commands then it works as expected.
Can anyone spot what I am obviously missing?
Regards
Garry


More information about the Zope mailing list