subprocess.Popen - file like object from stdout=PIPE

Helmut Jarausch jarausch at skynet.be
Wed Feb 4 08:00:53 EST 2009


Clovis Fabricio wrote:
> 2009/2/4 Helmut Jarausch <jarausch at skynet.be>:
>>> EQ.stdout is the filelike object you're looking for.
>>> communicate() grabs entire output at once so don't use it.
>> Thanks a lot, I haven't found that in the official documentation.
>> Helmut.
> 
> That would be a documentation bug.
> Fortunately it is not true. Here is it in the documentation:
> 
> http://docs.python.org/library/subprocess.html#subprocess.Popen.stdout

Thanks!

For people like me which don't always read until the end of a document
it would be nice if just after the paragraph

stdin, stdout and stderr specify the executed programs’ standard input, standard output and standard error file handles, 
respectively. Valid values are PIPE, an existing file descriptor (a positive integer), an existing file object, and 
None. PIPE indicates that a new pipe to the child should be created. With None, no redirection will occur; the child’s 
file handles will be inherited from the parent. Additionally, stderr can be STDOUT, which indicates that the stderr data 
from the applications should be captured into the same file handle as for stdout.

there would some lines like

These pipes are exposed as file-like objects which can be accessed via the
stdin, stdout or stderr (resp.) attributes of an object of class subprocess.Popen .

Please be indulgent to people like me.

Helmut.


-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Python-list mailing list