New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
popen spawned process may not write to stdout under windows #45707
Comments
Let child.py be: 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: cmd = 'python child.py'
for l in os.popen(cmd):
print l,
""" Then running it:
I would have expected at least: Am I wrong ? |
(I think the title you meant was The child is dying with IOError: Neither the docs for os.popen nor """ and this is the output, as """
2:stderr
>>> 1:stdout
>>> 3:stdout
0
""" Note the 2:stderr line lacking the
|
the popen call does not redirect stderr. command 2>&1 It is not popen to blame. |
pythonmeister: I never expected stderr to be redirected, just *all gagenellina: you are completely right about the failure. Still, this |
We've discussed this at the PyCon sprints, and here's the concensus: os.popen inherits the parents stderr, and on Windows there is not an However, popen is deprecated. The best solution would be to use Because popen is deprecated, we are going to leave this behavior and |
Did you want to close this, Sean? |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: