468,457 Members | 1,568 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

sys.stdout / sys.stderr, subprocess, redirection

Hello,

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

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 ".../__init__.py", line 40, in run
stderr = subprocess.STDOUT)
File "/usr/local/lib/python2.4/subprocess.py", line 554, in __init__
errread, errwrite)
File "/usr/local/lib/python2.4/subprocess.py", 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/subprocess.py", line 955, in _execute_child
File "/usr/local/lib/python2.4/os.py", line 341, in execvp
File "/usr/local/lib/python2.4/os.py", 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
http://svn.collab.net/viewcvs/svn/tr..._repos/hooks.c
(run_hook_cmd()).

--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991
Jul 18 '05 #1
0 2002

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Jacek Popławski | last post: by
reply views Thread by Christoph Haas | last post: by
3 posts views Thread by alf | last post: by
2 posts views Thread by gbastian | last post: by
2 posts views Thread by Greg Ercolano | last post: by
1 post views Thread by =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.