homepage

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: Using default encoding with `subprocess.run()` is not obvious
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: subprocess.run should alias universal_newlines to text
View: 31756
Assigned To: docs@python Nosy List: Xavier Robin, docs@python, eryksun, pekka.klarck
Priority: normal Keywords:

Created on 2018年04月23日 08:38 by pekka.klarck, last changed 2022年04月11日 14:58 by admin. This issue is now closed.

Messages (2)
msg315652 - (view) Author: Pekka Klärck (pekka.klarck) Date: 2018年04月23日 08:38
It is possible to use `subprocess.run()` with the system's default encoding by using `universal_newlines=True`. This is very handy, but it's not at all obvious (at least for me) that setting such option has effect on encoding. This is especially true when the docs don't explain this explicitly:
"""If encoding or errors are specified, or universal_newlines is true, file objects for stdin, stdout and stderr are opened in text mode using the specified encoding and errors or the io.TextIOWrapper default."""
This is such a useful feature that it ought to be documented better, preferably with an example.
From code reading point of view, I would also consider `encoding=True` to be more explicit that `universal_newlines=True`. I can submit a separate issue about that if others feel the same.
msg361000 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2020年01月30日 01:28
This issue was already addressed for 3.x in bpo-31756, which added the a `text` parameter and updated the documentation. As to 2.7, it was officially retired as of the first of this month. Anyway, I don't think there was a pressing need to clarify the documentation in 2.7.
History
Date User Action Args
2022年04月11日 14:58:59adminsetgithub: 77520
2020年01月30日 01:28:58eryksunsetstatus: open -> closed

superseder: subprocess.run should alias universal_newlines to text

nosy: + eryksun
messages: + msg361000
resolution: duplicate
stage: needs patch -> resolved
2020年01月29日 16:09:46Xavier Robinsetnosy: + Xavier Robin
2018年04月27日 18:38:53terry.reedysetnosy: + docs@python
versions: + Python 2.7, Python 3.6, Python 3.7, Python 3.8
assignee: docs@python
components: + Documentation
type: enhancement
stage: needs patch
2018年04月23日 08:38:32pekka.klarckcreate

AltStyle によって変換されたページ (->オリジナル) /