| Python Library Reference |
Availability:Unix, Windows.
This module allows you to spawn processes and connect to theirinput/output/error pipes and obtain their return codes underUnix and Windows.
Note that starting with Python 2.0, this functionality is availableusing functions from theos module which have the samenames as the factory functions here, but the order of the returnvalues is more intuitive in theos module variants.
The primary interface offered by this module is a trio of factoryfunctions. For each of these, ifbufsize is specified, it specifies the buffer size for the I/O pipes.mode, ifprovided, should be the string'b' or't'; on Windowsthis is needed to determine whether the file objects should be openedin binary or text mode. The default value formode is't'.
The only way to retrieve the return codes for the child processes isby using thepoll() orwait() methods on thePopen3 andPopen4 classes; these are only available onUnix. This information is not available when using thepopen2(),popen3(), andpopen4()functions, or the equivalent functions in theos module.
(child_stdout,child_stdin).(child_stdout,child_stdin,child_stderr).(child_stdout_and_stderr,child_stdin).New in version 2.0.On Unix, a class defining the objects returned by the factoryfunctions is also available. These are not used for the Windowsimplementation, and are not available on that platform.
If not using one off the helper functions to createPopen3objects, the parametercmd is the shell command to execute in asub-process. Thecapturestderr flag, if true, specifies thatthe object should capture standard error output of the child process.The default is false. If thebufsize parameter is specified, itspecifies the size of the I/O buffers to/from the child process.
| Python Library Reference |