[ python-Bugs-1180160 ] subprocess.Popen fails with closed stdout

SourceForge.net noreply at sourceforge.net
Sun Apr 10 13:41:18 CEST 2005


Bugs item #1180160, was opened at 2005-04-10 13:41
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180160&group_id=5470

Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: neuhauser (neuhauser)
Assigned to: Nobody/Anonymous (nobody)
Summary: subprocess.Popen fails with closed stdout

Initial Comment:
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          
                         

http://docs.python.org/lib/node230.html claims that
"PIPE indicates that a new pipe to the child should be
created" which doesn't seem to be the case.

Subversion code that runs the script can be seen at   
                         
http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_repos/hooks.c
       
(run_hook_cmd()).


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1180160&group_id=5470


More information about the Python-bugs-list mailing list