$ python tee_test.py [stdout] hello [stderr] hello [stdout] world [stderr] world [stdout] not going to be written to file [stderr] not going to be written to file $ cat mystdout.txt [stdout] hello ...
Python provides no native access to libc's FILE *stdout stream, so ctypes must be used to both look up the libc stdout variable and call libc's fflush () function. This option will work with terminals ...