mode parameter in popen2-4

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Aug 20 23:46:16 EDT 2007


On 20 ago, 17:26, Tobiah <t... at tobiah.org> 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 <http://docs.python.org/lib/os-newstreams.html> and
<http://docs.python.org/lib/module-popen2.html>

--
Gabriel Genellina




More information about the Python-list mailing list