I have a Python program in which I have some Print statements, followed by calls to some c++ executables from which I also get some output to the stdout. When I run this python script in a unix terminal I get output on the screen as expected (in the correct order i.e. first from the print an then from c++ executables). The problem is when I redirect this output to a file like
python test.py > out.txt
I get the output in the wrong order. I get the output of the c++ executables first and then the other.
sys.stdout?