Question about propagating universal_newlines through subprocess.Popen to io.TextIOWrapper

eryk sun eryksun at gmail.com
Mon Jun 26 17:22:53 EDT 2017


On Mon, Jun 26, 2017 at 8:59 PM, Bill Deegan <bill at baddogconsulting.com> wrote:
>
> Ideally (for my use case) it would be something which propagated
> universal_newlines to io.TextIOWrapper().. rather than discards it.
> In my case I want the stdout to be encoded utf-8, but I do not want \r's
> changed to \n's as my test system is capturing the output of a progress
> indicator which uses \r to return to beginning of line and overwrite the
> previous output.

An enhancement issue can be created for 3.7, but this is new behavior
that certainly won't be backported to 3.6. For now you'll have to do
it yourself. Leave out the encoding argument, and manually wrap
p.stdout with an io.TextIOWrapper that sets the newline argument to an
empty string.



More information about the Python-list mailing list