[Tutor] HELP: using popen2/popen3

Jerome Jabson jjabson at yahoo.com
Fri May 5 00:48:35 CEST 2006


Hello,

I'm trying to start a shell script from my python
script using os.spawnlp. But I'm not getting msgs from
stderr. I thought that I could use popen2/popen3 to
replace os.spawnlp but I'm having problems with syntax
and how to do this. Can someone point me in the right
direction? Here's my original script (w/o using
popen2/popen3):


import os
import sys

####################
#### Definition ####
####################

def set_up():
   print "=== Starting Setup ==="
   os.chdir('/home/qauser/jerome')
   os.spawnlp(os.P_WAIT,
'/home/qauser/jerome/qaSetup.sh')
   print "=== Setup  Complete ==="

####################
######  Main  ######
####################

set_up()


I was trying to replace the os.spawnlp with:

sout, sin, serr =
os.open('/home/qauser/jerome/qaSetup.sh')
sout.readlines()
serr.readlines()
sout.close()
serr.close()
sin.close()

Many thanks,
Jerome

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list