newbie pipes question

David Lees DavidLnospammy at raqia.com
Fri Jul 20 11:07:57 EDT 2001


I am running under redhat 7.1 with python 2.1 and want to have python
process the output of a perl script.

I execute the perl script from python as:

os.system("regex2.pl -o junky 'birds'")

and the output goes to my screen, presumably stdout.

I can redirect the output to a temporary file and read it pack into
python, but the right way would seem to be pipes.  Can someone tell me
how to do this?  I tried the following, which does not work, because it
seems to hang on the os.read statement:

r,w=os.pipe()
os.system("regex2.pl -o junky 'birds'")
x=os.read(r,100)
print x

Thanks in advance,

david lees



More information about the Python-list mailing list