Open petercorke opened 4 years ago
On Python 3.9.2 (macOS Big Sur) I find that bufsize=1
for the default ASCII mode still leads to a bunch of warnings:
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py:946: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
self.stderr = io.open(errread, 'rb', bufsize)
On the other hand, bufsize=-1
(the default value, which "means the system default of io.DEFAULT_BUFFER_SIZE
will be used") works without any warnings. The warning message above suggests that this is happening behind the scenes anyway.
I tested bufsize=-1
with UTF-8 input and output and it Works For Me, so it seems that just removing the bufsize
keyword argument suffices, at least on my system!
With python 3.8 and unicode output mode
I get lots of error messages like
This is a simple fix, that maintains back compatibility with the default ASCII mode.