This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: subprocess.check_output incorrectly state that output is always bytes
Type: behavior Stage: commit review
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Baptiste.Lepilleur, docs@python, python-dev, r.david.murray, terry.reedy
Priority: normal Keywords:

Created on 2013-02-24 11:43 by Baptiste.Lepilleur, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg182868 - (view) Author: Baptiste Lepilleur (Baptiste.Lepilleur) Date: 2013-02-24 11:43
Documentation states:

>>> help( subprocess.check_output )
check_output(*popenargs, timeout=None, **kwargs)
    Run command with arguments and return its output as a byte string.

But the most common usage is:
>>> subprocess.check_output( 'echo test', shell=True, universal_newlines=True )
'test\n'

Which obviously output a text string, not a byte string.

IMHO, one of the example should also be modified to show the existence of this flag, as it is what user want 90% of the times.
msg182877 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-02-24 15:08
IMO the statement should read "and return the stdout data".  The point is that check_output calls Popen and accepts all its arguments except for stdout, which it handles itself and returns as the result.  It would probably be good to then follow that up with something like "This will be bytes unless universal_newlines is set True".
msg184743 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-20 06:37
New changeset f4accfad1bf6 by Gregory P. Smith in branch '3.3':
clarifiy the documentation for issue17285. see also commit
http://hg.python.org/cpython/rev/f4accfad1bf6

New changeset d31cab1dabae by Gregory P. Smith in branch 'default':
clarifiy the documentation for issue17285. see also commit
http://hg.python.org/cpython/rev/d31cab1dabae
History
Date User Action Args
2022-04-11 14:57:42adminsetgithub: 61487
2013-03-20 06:38:08gregory.p.smithsetstatus: open -> closed
resolution: fixed
stage: needs patch -> commit review
2013-03-20 06:37:07python-devsetnosy: + python-dev
messages: + msg184743
2013-03-01 22:45:01terry.reedysetnosy: + terry.reedy

versions: + Python 3.4, - Python 3.1
2013-02-24 15:08:06r.david.murraysetnosy: + r.david.murray
messages: + msg182877

type: behavior
stage: needs patch
2013-02-24 11:43:50Baptiste.Lepilleurcreate