On 18/12/2009 9:33 AM, Chris Withers wrote:
exar...@twistedmatrix.com wrote:
libc is probably giving you line buffering when you use os.system
(because the child process inherits the parent's stdio, and the
parent's stdio is probably a pty, and that's the policy libc implements).

<snip>

Interesting, but do these assertions still hold true when I tell you
that I'm doing all this on Windows? ;-)

Yep. You can see similar behaviour from just the cmd-prompt and the following script:

--
import sys
for i in range(10):
  print "stdout"
  print >> sys.stderr, "stderr"
--

If you execute it "normally" from a command-prompt, you will see things written in the correct order. If you execute it like 'python foo.py > out 2>&1', the order will be mixed up. If you execute it like 'python -u foo.py > out 2>&1' the order is restored.

HTH,

Mark
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to