@@ -68,13 +68,13 @@ This module defines one class called :class:`Popen`:
6868 specified by the :envvar: `COMSPEC ` environment variable.
6969
7070 *stdin *, *stdout * and *stderr * specify the executed programs' standard input,
71- standard output and standard error file handles, respectively. Valid values are
72- `` PIPE `` , an existing file descriptor (a positive integer), an existing file
73- object, and ``None ``. `` PIPE `` indicates that a new pipe to the child should be
74- created. With ``None ``, no redirection will occur; the child's file handles
75- will be inherited from the parent. Additionally, * stderr * can be `` STDOUT `` ,
76- which indicates that the stderr data from the applications should be captured
77- into the same file handle as for stdout.
71+ standard output and standard error file handles, respectively. Valid values
72+ are :data: ` PIPE `, an existing file descriptor (a positive integer), an
73+ existing file object, and ``None ``. :data: ` PIPE ` indicates that a new pipe
74+ to the child should be created. With ``None ``, no redirection will occur;
75+ the child's file handles will be inherited from the parent. Additionally,
76+ * stderr * can be :data: ` STDOUT `, which indicates that the stderr data from the
77+ applications should be captured into the same file handle as for stdout.
7878
7979 If *preexec_fn * is set to a callable object, this object will be called in the
8080 child process just before the child is executed. (Unix only)
@@ -114,6 +114,20 @@ This module defines one class called :class:`Popen`:
114114 of the main window and priority for the new process. (Windows only)
115115
116116
117+ .. data :: PIPE
118+
119+ Special value that can be used as the *stdin *, *stdout * or *stderr * argument
120+ to :class: `Popen ` and indicates that a pipe to the standard stream should be
121+ opened.
122+
123+
124+ .. data :: STDOUT
125+
126+ Special value that can be used as the *stderr * argument to :class: `Popen ` and
127+ indicates that standard error should go into the same handle as standard
128+ output.
129+
130+
117131Convenience Functions
118132^^^^^^^^^^^^^^^^^^^^^
119133
@@ -229,7 +243,7 @@ Instances of the :class:`Popen` class have the following methods:
229243 *input * argument should be a byte string to be sent to the child process, or
230244 ``None ``, if no data should be sent to the child.
231245
232- :meth: `communicate ` returns a tuple ``(stdout, stderr ) ``.
246+ :meth: `communicate ` returns a tuple ``(stdoutdata, stderrdata ) ``.
233247
234248 Note that if you want to send data to the process's stdin, you need to create
235249 the Popen object with ``stdin=PIPE ``. Similarly, to get anything other than
@@ -277,20 +291,21 @@ The following attributes are also available:
277291
278292.. attribute :: Popen.stdin
279293
280- If the *stdin * argument is `` PIPE `` , this attribute is a file object that
281- provides input to the child process. Otherwise, it is ``None ``.
294+ If the *stdin * argument was :data: ` PIPE `, this attribute is a file object
295+ that provides input to the child process. Otherwise, it is ``None ``.
282296
283297
284298.. attribute :: Popen.stdout
285299
286- If the *stdout * argument is `` PIPE `` , this attribute is a file object that
287- provides output from the child process. Otherwise, it is ``None ``.
300+ If the *stdout * argument was :data: ` PIPE `, this attribute is a file object
301+ that provides output from the child process. Otherwise, it is ``None ``.
288302
289303
290304.. attribute :: Popen.stderr
291305
292- If the *stderr * argument is ``PIPE ``, this attribute is file object that
293- provides error output from the child process. Otherwise, it is ``None ``.
306+ If the *stderr * argument was :data: `PIPE `, this attribute is a file object
307+ that provides error output from the child process. Otherwise, it is
308+ ``None ``.
294309
295310
296311.. attribute :: Popen.pid
@@ -374,8 +389,8 @@ A more realistic example would look like this::
374389 print("Execution failed:", e, file=sys.stderr)
375390
376391
377- Replacing os.spawn\*
378- ^^^^^^^^^^^^^^^^^^^^
392+ Replacing the os.spawn family
393+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
379394
380395P_NOWAIT example::
381396
@@ -402,8 +417,8 @@ Environment example::
402417 Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})
403418
404419
405- Replacing os.popen\*
406- ^^^^^^^^^^^^^^^^^^^^
420+ Replacing os.popen
421+ ^^^^^^^^^^^^^^^^^^
407422
408423::
409424
@@ -416,4 +431,3 @@ Replacing os.popen\*
416431 pipe = os.popen(cmd, 'w', bufsize)
417432 ==>
418433 pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin
419-
0 commit comments