Shell re-direction

Mike Gould mike at meph.net
Sun Mar 20 17:43:27 EST 2005


Hi all,
I have a very strange problem with the output run from commands run via 
os.system().  If the python script is run without re-direction the 
output appears as expected, but if I re-direct the output from the 
script the output gets re-ordered.

For example given the following script:

import os
print '1'
os.system('echo 2')
print '3'

$ python test.py
1
2
3
$ python test.py | cat
2
1
3

Can anyone explain what's going on here?

Thanks
Mike



More information about the Python-list mailing list