popen3 and Perforce

Ruchika ruchika_khera at hotmail.com
Thu Sep 9 01:28:11 EDT 2004


Hi,

I am trying to automate the build process for which I need to run P4
commands from the Python script. After getting sources from Perforce,
I need to build them using Visual C++ from the script.
I wrote a small script that calls the P4 sync command from the script
-

try:
     in, out, err = os.popen3('P4 -s sync -f /dev/src/...')
     x = len (in.readlines())
     y = len (out.readlines())
     z = len (err.readlines())
     print x
     print y
     print z
except IOError:
     print "IOError"
except:
     print "Unknown"

Tha above returns from os.opopen3 almost immediately, goes to x = len
(in.readlines()) and then jumps to the IOError exception.
Can anyone help me figure out whats happening.
Is this the right way of using popen3 commands. Anyone has other
suggestions on how to automate this. Do I need to wait for the "P4
sync" command to complete before proceeding with reading from the
files?
How would I know if the "P4 sync" command is actually executing?

Thanks.
Ruchika



More information about the Python-list mailing list