New submission from Pekka Klärck <pekka.kla...@gmail.com>:

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.

----------
messages: 315652
nosy: pekka.klarck
priority: normal
severity: normal
status: open
title: Using default encoding with `subprocess.run()` is not obvious

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33339>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to