[New-bugs-announce] [issue30488] Documentation for subprocess.STDOUT needs clarification

Max report at bugs.python.org
Fri May 26 13:42:41 EDT 2017

New submission from Max:

The documentation states that subprocess.STDOUT is:

Special value that can be used as the stderr argument to Popen and indicates that standard error should go into the same handle as standard output.

However, when Popen is called with stdout=None, stderr=subprocess.STDOUT, stderr is not redirected to stdout and continues to be sent to stderr.

To reproduce the problem:

$ python >/dev/null -c 'import subprocess;\
                        subprocess.call(["ls", "/404"],stderr=subprocess.STDOUT)'

and observe the error message appearing on the console (assuming /404 directory does not exist).

This was reported on SO 5 years ago: https://stackoverflow.com/questions/11495783/redirect-subprocess-stderr-to-stdout.

The SO attributed this to a documentation issue, but arguably it should be considered a bug because there seems to be no reason to make subprocess.STDOUT unusable in this very common use case.

components: Interpreter Core
messages: 294560
nosy: max
priority: normal
severity: normal
status: open
title: Documentation for subprocess.STDOUT needs clarification
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list