popen help

Jason Zheng jzheng at jpl.nasa.gov
Fri Nov 12 20:29:46 CET 2004


I'm trying to open a subshell to run some csh commands, and I want to 
connect the stdout of the subshell to the main stdout:

sub = Popen4('csh -f')
sub.tochild.write('source source.me\n')
sub.tochild.write('runthis\n')
sub.tochild.close()

for x in sub.fromchild.readlines():
   print x

The way I have it can only display everything after the execution of the 
commands that I send to the subshell. Is there a way to display the 
output as the subshell execute those commands?

Thanks in advance,



More information about the Python-list mailing list