Question about propagating universal_newlines through subprocess.Popen to io.TextIOWrapper
Bill Deegan
bill at baddogconsulting.com
Mon Jun 26 13:23:45 EDT 2017
Greetings,
I was surprised to see that if I set encoding in my call to
subprocess.Popen() as follows:
p = Popen(cmd,
stdin=stdin,
stdout=subprocess.PIPE,
stderr=stderr_value,
env=os.environ,
universal_newlines=False, #universal_newlines,
encoding='utf-8')
That universal_newlines value is discarded due to:
text_mode = encoding or errors or universal_newlines
...
if text_mode:
self.stdout = io.TextIOWrapper(self.stdout,
encoding=encoding, errors=errors)
There doesn't seem to be a way to set encoding without forcing
univeral_newlines.
This seems like a bug?
-Bill
More information about the Python-list
mailing list