popen3 and Perforce

R

Ruchika

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
 
S

Sam Holden

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.

Reading from an output only filehandle is probably doomed to fail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top