line buffering (buffering=1) warning on Python 3.8
See original GitHub issueSince the recent change made in #1014, I got a warning like below when launching images based on Python 3.8 (python=3.8
in environment.yml).
/srv/conda/envs/notebook/lib/python3.8/subprocess.py:848: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
I believe this issue is related to the change in Python 3.8 where it started complaining whereas previous versions silently ignored buffering=1
for binary mode. I guess the related code is below:
Not sure if related, I also noticed texts on the console (mostly) lost colors after this recent change; Jupyter log messages used to have colored headings for warning/info/etc, but they are now all monochrome. Yet some texts are still printed in colors (i.e. Julia banner lost colors, but its prompt still has a color).
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
line buffering (buffering=1) isn't supported in binary mode, the ...
python3 RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used · Subscribe to RSS.
Read more >pssh is output RuntimeWarning when using Python3.8
When using pssh commands with -e or -o options,I received below warning. ... RuntimeWarning: line buffering (buffering=1) isn't supported in ...
Read more >line buffering (buffering=1) isn't supported in binary mode, the ...
I also got lots of these warning messages. The warning was added upstream in the following commit: https://github.com/python/cpython/commit/ ...
Read more >open() shouldn't silently ignore buffering=1 in binary mode
In binary mode, setting buffering to 1 is silently ignored and equivalent to using default buffer size. I argue that such behavior is:...
Read more >line buffering (buffering=1) isn't supported in binary mode with ...
Running latest codespell under Python 3.8 results in the following warning: .pyenv/versions/3.8.0/lib/python3.8/codecs.py:905: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Before we fix the TTY issue we should decide what beahaviour we want.
If you’re running repo2docker from the command line with default options it’ll output the logs to the console, in which case colour logs makes sense, and doing this through a pty(?) makes sense since in principle someone could provide input via stdin. If it’s run as a background container or a Kubernetes pod you wouldn’t expect a terminal to be connected so non-colour logs makes sense.
The warning about
buffering=1
is coming from io.open() acceptsbuffering
which is set tobufsize
whenio.open()
is called in subprocess.Popen(). AFAICT, it’s not about a typo betweenbuffering
andbufsize
, but more about the value itself.On the other hand, Julia running on an image created by the latest repo2docker has
stdout
mapped to pipe which is as expected with the recent change.It turns out Julia initializes colored stdout for non-TTY only when it’s given an explicit option (
color=yes
, not defaultauto
) that explains my experience.It’s likely Jupyter (and IPython) works in a similar way that they ended up getting a non-color output here. Seems like this kind of issue is not uncommon as Python has a package like ptyprocess.