[issue1366] popen spawned process may not write to stdout under windows

2007-10-31 Thread Patrick Mézard

New submission from Patrick Mézard:

Let child.py be:
"""
import sys

sys.stdout.write('1:stdout\n')
sys.stdout.flush()
sys.stderr.write('2:stderr\n')
sys.stderr.flush()
sys.stdout.write('3:stdout\n')
sys.stdout.flush()
"""

and parent.py:
"""
import os

cmd = 'python child.py'
for l in os.popen(cmd):
print l,
"""

Then running it:
"""
>python parent.py
1:stdout

>python
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit
(Intel)] on win32
"""

I would have expected at least:
"""
1:stdout
3:stdout
"""
to be output, which actually happens if the stderr is nullified like
"python child.py 2>nul" in parent.py call.

Am I wrong ?

--
components: Windows
messages: 56991
nosy: pmezard
severity: normal
status: open
title: popen spawned process may not write to stdout under windows
type: behavior
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1366>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1366] popen spawned process may not write to stdout under windows

2007-11-08 Thread Patrick Mézard

Patrick Mézard added the comment:

pythonmeister: I never expected stderr to be redirected, just *all
stdout* to be captured. But...

gagenellina: you are completely right about the failure. Still, this
issue happened with a real world application written in C, and
redirecting manually stderr to :NUL: solved it unexpectedly. I did not
expect spawned process behaviour to differ when its stderr is being
redirected.

__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1366>
__
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com