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.

Title: subprocess PIPEs are byte streams
Type: Stage: resolved
Components: Documentation Versions: Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: akuchling, docs@python, python-dev, sam.kimbrel, v+python
Priority: normal Keywords: patch

Created on 2010-11-21 05:57 by v+python, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
10481-subprocess-docs.diff sam.kimbrel, 2014-04-14 18:21 review
Messages (5)
msg121869 - (view) Author: Glenn Linderman (v+python) * Date: 2010-11-21 05:57
While did clarify the fact that the .communicate API takes a byte stream as input, it is easy to miss the implication.  Because Python programs start up with stdin as a text stream, it might be good to point out that some action may need to be taken to be sure that the receiving program expects a byte stream, or that the byte stream supplied should be in an encoding that the receiving program is expecting and can decode appropriately.

No mention is presently made in the documentation for .communicate that its output is also a byte stream, and if text will correspond to whatever encoding is used by the sending program.
msg121870 - (view) Author: Glenn Linderman (v+python) * Date: 2010-11-21 06:00
Maybe it should also be mentioned that p.stdout and p.stderr and p.stdin, when set to be PIPEs, are also byte streams.  Of course that is the reason that communicate accepts and produces byte streams.
msg216153 - (view) Author: Sam Kimbrel (sam.kimbrel) * Date: 2014-04-14 18:21
I've created a patch that updates the docs to reflect the behavior of communicate() and check_output(), which is that both the "input" argument and stdin/stdout/stderr PIPEs will convert to and from strings when self.univeral_newlines is True and must be bytes otherwise.
msg216178 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-04-14 19:08
New changeset 267fff541bda by Andrew Kuchling in branch 'default':
#10481: describe universal_newlines' effect on communicate()/check_output() output (alternately bytes or strings)
msg216180 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2014-04-14 19:10
Thanks for your patch!
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54690
2014-04-14 19:10:18akuchlingsetstatus: open -> closed

nosy: + akuchling
messages: + msg216180

resolution: fixed
stage: resolved
2014-04-14 19:08:42python-devsetnosy: + python-dev
messages: + msg216178
2014-04-14 18:58:51akuchlingsetversions: + Python 3.5, - Python 3.2
2014-04-14 18:21:57sam.kimbrelsetfiles: + 10481-subprocess-docs.diff

nosy: + sam.kimbrel
messages: + msg216153

keywords: + patch
2010-11-21 06:00:18v+pythonsetmessages: + msg121870
2010-11-21 05:57:01v+pythoncreate