I am trying to redirect output, and flush every once in a while to clear the buffer.
Flushing doesn't do anything - can't even enter the function with debugger.
from io import BytesIO as StringIO
out = StringIO()
out.write("hi")
output = out.getvalue().strip()
assert output == "hi"
out.flush()
output = out.getvalue().strip()
assert output == ""
The second assertion fails, as output is still "hi". flush()
did nothing.
What am I getting wrong?