sys.stdout / sys.stderr, subprocess, redirection

  • Thread starter Roman Neuhauser
  • Start date

Roman Neuhauser


I have a piece of code that gets run in a script that has its stdout

import sys
sys.stdout = sys.stderr

c = subprocess.Popen (...,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT)

and this is what I get:

Sending SVNR/permissions
Transmitting file data .svn: Commit failed (details follow):
svn: 'pre-commit' hook failed with error output:
Traceback (most recent call last):
File ".../", line 40, in run
stderr = subprocess.STDOUT)
File "/usr/local/lib/python2.4/", line 554, in __init__
errread, errwrite)
File "/usr/local/lib/python2.4/", line 986, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

This is the child_traceback:

File "/usr/local/lib/python2.4/", line 955, in _execute_child
File "/usr/local/lib/python2.4/", line 341, in execvp
File "/usr/local/lib/python2.4/", line 379, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory

Is this a problem in subprocess (I'm using the FreeBSD port of Python-2.4
and subprocess that comes with that release) or is this expected? If my
expectations are broken (likely), what should the standard descriptor
massaging look like?

Subversion code that runs the script can be seen at

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Latest member

Latest Threads