| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="popen2-flow-control.html" /> |
| 13 | <link rel="prev" href="module-popen2.html" /> |
| 14 | <link rel="parent" href="module-popen2.html" /> |
| 15 | <link rel="next" href="popen2-flow-control.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>6.9.1 Popen3 and Popen4 Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="6.9 popen2 " |
| 25 | href="module-popen2.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="6.9 popen2 " |
| 28 | href="module-popen2.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="6.9.2 Flow Control Issues" |
| 31 | href="popen2-flow-control.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="module-popen2.html">6.9 popen2 </A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-popen2.html">6.9 popen2 </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="popen2-flow-control.html">6.9.2 Flow Control Issues</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION008910000000000000000"></A><A NAME="popen3-objects"></A> |
| 56 | <BR> |
| 57 | 6.9.1 Popen3 and Popen4 Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | Instances of the <tt class="class">Popen3</tt> and <tt class="class">Popen4</tt> classes have the |
| 62 | following methods: |
| 63 | |
| 64 | <P> |
| 65 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 66 | <td><nobr><b><tt id='l2h-1849' xml:id='l2h-1849' class="method">poll</tt></b>(</nobr></td> |
| 67 | <td><var></var>)</td></tr></table></dt> |
| 68 | <dd> |
| 69 | Returns <code>-1</code> if child process hasn't completed yet, or its return |
| 70 | code otherwise. |
| 71 | </dl> |
| 72 | |
| 73 | <P> |
| 74 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 75 | <td><nobr><b><tt id='l2h-1850' xml:id='l2h-1850' class="method">wait</tt></b>(</nobr></td> |
| 76 | <td><var></var>)</td></tr></table></dt> |
| 77 | <dd> |
| 78 | Waits for and returns the status code of the child process. The |
| 79 | status code encodes both the return code of the process and |
| 80 | information about whether it exited using the <tt class="cfunction">exit()</tt> |
| 81 | system call or died due to a signal. Functions to help interpret the |
| 82 | status code are defined in the <tt class="module"><a href="module-os.html">os</a></tt> module; see section |
| 83 | <A href="os-process.html#os-process">6.1.5</A> for the <tt class="function">W<var>*</var>()</tt> family of functions. |
| 84 | </dl> |
| 85 | |
| 86 | <P> |
| 87 | The following attributes are also available: |
| 88 | |
| 89 | <P> |
| 90 | <dl><dt><b><tt id='l2h-1851' xml:id='l2h-1851' class="member">fromchild</tt></b></dt> |
| 91 | <dd> |
| 92 | A file object that provides output from the child process. For |
| 93 | <tt class="class">Popen4</tt> instances, this will provide both the standard output |
| 94 | and standard error streams. |
| 95 | </dl> |
| 96 | |
| 97 | <P> |
| 98 | <dl><dt><b><tt id='l2h-1852' xml:id='l2h-1852' class="member">tochild</tt></b></dt> |
| 99 | <dd> |
| 100 | A file object that provides input to the child process. |
| 101 | </dl> |
| 102 | |
| 103 | <P> |
| 104 | <dl><dt><b><tt id='l2h-1853' xml:id='l2h-1853' class="member">childerr</tt></b></dt> |
| 105 | <dd> |
| 106 | A file object that provides error output from the child process, if |
| 107 | <var>capturestderr</var> was true for the constructor, otherwise |
| 108 | <code>None</code>. This will always be <code>None</code> for <tt class="class">Popen4</tt> |
| 109 | instances. |
| 110 | </dl> |
| 111 | |
| 112 | <P> |
| 113 | <dl><dt><b><tt id='l2h-1854' xml:id='l2h-1854' class="member">pid</tt></b></dt> |
| 114 | <dd> |
| 115 | The process ID of the child process. |
| 116 | </dl> |
| 117 | |
| 118 | <P> |
| 119 | |
| 120 | <DIV CLASS="navigation"> |
| 121 | <div class='online-navigation'> |
| 122 | <p></p><hr /> |
| 123 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 124 | <tr> |
| 125 | <td class='online-navigation'><a rel="prev" title="6.9 popen2 " |
| 126 | href="module-popen2.html"><img src='../icons/previous.png' |
| 127 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 128 | <td class='online-navigation'><a rel="parent" title="6.9 popen2 " |
| 129 | href="module-popen2.html"><img src='../icons/up.png' |
| 130 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 131 | <td class='online-navigation'><a rel="next" title="6.9.2 Flow Control Issues" |
| 132 | href="popen2-flow-control.html"><img src='../icons/next.png' |
| 133 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 134 | <td align="center" width="100%">Python Library Reference</td> |
| 135 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 136 | href="contents.html"><img src='../icons/contents.png' |
| 137 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 138 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 139 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 140 | <td class='online-navigation'><a rel="index" title="Index" |
| 141 | href="genindex.html"><img src='../icons/index.png' |
| 142 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 143 | </tr></table> |
| 144 | <div class='online-navigation'> |
| 145 | <b class="navlabel">Previous:</b> |
| 146 | <a class="sectref" rel="prev" href="module-popen2.html">6.9 popen2 </A> |
| 147 | <b class="navlabel">Up:</b> |
| 148 | <a class="sectref" rel="parent" href="module-popen2.html">6.9 popen2 </A> |
| 149 | <b class="navlabel">Next:</b> |
| 150 | <a class="sectref" rel="next" href="popen2-flow-control.html">6.9.2 Flow Control Issues</A> |
| 151 | </div> |
| 152 | </div> |
| 153 | <hr /> |
| 154 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 155 | </DIV> |
| 156 | <!--End of Navigation Panel--> |
| 157 | <ADDRESS> |
| 158 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 159 | </ADDRESS> |
| 160 | </BODY> |
| 161 | </HTML> |