Thanks this works (if you add shell=True in Popen).
If I don't want to use shell = True, how can I redirect the stdout to 
named_pipe? Popen accepts an open file handle for stdout, which I can't open 
for writing because that blocks the process...

> 
> 
> os.mkfifo("named_pipe", 0777)
> 
> ls_process = subprocess.Popen("ls -lah > named_pipe")
> 
> pipe = open("named_pipe", "r")
> 
> # Read the output of the subprocess from the pipe.
> 
> 
> 
> When the subprocess terminates (look at the docs for Popen objects),
> 
> close and delete the fifo.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to