Featured image of post Don't Buffer Python's stdout

Don't Buffer Python's stdout

I was using [tee](http://man7.org/linux/man-pages/man1/tee.1.html) with a long running Python process, but I wasn’t seeing any output. This is a result of Python buffering the stdout stream. You can run force Python to run in unbuffered mode using the -u flag at the command line.

Force stdin, stdout and stderr to be totally unbuffered. On systems where it matters, also put stdin, stdout and stderr in binary mode.

Last updated on Feb 26, 2024 09:22 -0500
Feedback
FOOTER