This module allows you to spawn processes and connect to their
input/output/error pipes and obtain their return codes under
Unix and Windows.
Note that starting with Python 2.0, this functionality is available
using functions from the os module which have the same
names as the factory functions here, but the order of the return
values is more intuitive in the os module variants.
The primary interface offered by this module is a trio of factory
functions. For each of these, 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
The only way to retrieve the return codes for the child processes is
by using the poll() or wait() methods on the
Popen3 and Popen4 classes; these are only available on
Unix. This information is not available when using the
popen2(), popen3(), and popen4()
functions, or the equivalent functions in the os module.
This class represents a child process. Normally, Popen3
instances are created using the popen2() and
popen3() factory functions described above.
If not using one off the helper functions to create Popen3
objects, the parameter cmd is the shell command to execute in a
sub-process. The capturestderr flag, if true, specifies that
the object should capture standard error output of the child process.
The default is false. If the bufsize parameter is specified, it
specifies the size of the I/O buffers to/from the child process.