[Python-ideas] Subprocess: Add an encoding argument

Antoine Pitrou solipsis at pitrou.net
Sat Aug 30 13:07:29 CEST 2014


On Fri, 29 Aug 2014 18:39:35 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> 
> This actually gets a little messy once you start digging into it, as you
> actually have up to 3 streams to deal with (stdin, stdout, stderr), and may
> want to set the error handler in addition to the encoding.

At this point, I'd suggest creating a clean, separate TextPopen class
(or subclass) without any legacy argument baggage.

As for per-stream settings, we could allow passing each of *encoding*
and *errors* in two forms:
- as a string, in which case it applies to all three pipes
- as a dict, in which case it is looked up for each of the "stdin",
  "stdout", "stderr" pipes (if configured as pipes)

We could then deprecate the bogus-named "universal_newlines" in the
main Popen class.

Regards

Antoine.




More information about the Python-ideas mailing list