Using following code:
import sys
print("INFO", flush=True, file=sys.stdout)
print("ERROR", flush=True, file=sys.stderr)
Sometimes the output is:
ERROR
INFO
and sometimes
INFO
ERROR
How can one make it to always print by the order written in the code?