"The system cannot find the specified file" when calling subprocess.Popen in python

I am trying to use svnmerge.py to merge some files. Under the hood, it uses python, and when I use it, I get the error "The system cannot find the specified file." Colleagues at work run the same version of svnmerge.py and python (2.5.2, in particular r252: 60911) without problems.

I found this link that describes my problem. Trying to find out what was pointed out there, I confirmed that Python can find svn (this is in my way):

P: \> python 
Python 2.5.2 (r252: 60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import os 
>>> i, k = os.popen4 ("svn --version") 
>>> i.close () 
>>> k.readline () 
'svn, version 1.4.2 (r22196) \ n' 

Looking at the svnmerge.py code, I noticed that for python version 2.4 and above it was executing a different execution path. Instead of referencing, os.popen4 () uses the .Popen () subprocess. Trying to reproduce the error:

C: \> python
Python 2.5.2 (r252: 60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> p = subprocess.Popen ("svn --version", stdout = subprocess.PIPE, 
>>> close_fds = False, stderr = subprocess.PIPE)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python25\lib\subprocess.py", line 594, in __init__
    errread, errwrite)
  File "C:\Python25\lib\subprocess.py", line 816, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
>>>

2,4- , .

, python, google . ?

+5
1

, . subprocess.Popen. "shell=True ", ['svn', '--version']. , Popen , ," svn -version ", .

, , , Python... FWIW, mac, : .

+13

All Articles