Is there a way to increase the stdout
buffer size from 8182 in Python
or
to delay the flush until I actually call flush
?
Things I've tried that don't work:
- I can get around this issue on Windows because I can access the buffer directly (e.g. see my answer to this post). But this doesn't work for Unix.
- I can increase the buffer size for a file by passing
buffer
to the constructor, howeverstdout
is already constructed. - Turning off buffering (
python -u
) obviously makes things worse! - Using a temporary buffer encounters the same problems -
stdout
is flushed after every 8192nd byte is copied from the temporary buffer.
Rationale: The aim here is to reduce console flickering. Buffering everything, as per this question indeed works, for instance when I try in C or by using the Windows API in Python, but the 8182 limit in Python seems to be causing problems that I can't get around on Unix.