mode parameter in popen2-4

Gabriel Genellina gagsl-py2 at
Tue Aug 21 05:46:16 CEST 2007

On 20 ago, 17:26, Tobiah <t... at> wrote:

> In the popen docs, a file like object is returned,
> and may be read to or written to depending on the
> 'mode' parameter ('r', or 'w').
> Why is the mode parameter needed for popen2 and greater,
> when both a stdin and stdout object is returned?  One
> wouldn't want to 'append' to a stream.... is it because
> binary mode can still be turned on and off this way?

Exactly. For popen[234] the mode parameter can be either 't' or 'b',
not 'r' or 'w' - which you could have learned easily reading the
documentation at <> and

Gabriel Genellina

More information about the Python-list mailing list