These functions create new file objects.
'r'
(default) or 'w'
.
The bufsize argument has the same meaning as the corresponding
argument to the built-in open() function. The exit status of
the command (encoded in the format specified for wait()) is
available as the return value of the close() method of the file
object, except that when the exit status is zero (termination without
errors), None
is returned.
Availability: Unix, Windows.
Changed in version 2.0: This function worked unreliably under Windows in earlier versions of Python. This was due to the use of the _popen() function from the libraries provided with Windows. Newer versions of Python do not use the broken implementation from the Windows libraries.
For each of these popen() variants, if bufsize is
specified, it specifies the buffer size for the I/O pipes.
mode, if provided, should be the string 'b'
or
't'
; on Windows this is needed to determine whether the file
objects should be opened in binary or text mode. The default value
for mode is 't'
.
(child_stdin, child_stdout)
.
Availability: Unix, Windows.
New in version 2.0.
(child_stdin, child_stdout, child_stderr)
.
Availability: Unix, Windows.
New in version 2.0.
(child_stdin, child_stdout_and_stderr)
.
Availability: Unix, Windows.
New in version 2.0.
This functionality is also available in the popen2 module using functions of the same names, but the return values of those functions have a different order.
See About this document... for information on suggesting changes.