我正在尝试使用svnmerge.py
合并一些文件。它在底层使用 python,当我使用它时,我收到一个错误 - “系统找不到指定的文件”。工作中的同事正在运行相同版本的svnmerge.py
,以及 python(2.5.2,特别是 r252:60911),没有问题。
I found 这个链接 http://www.nabble.com/problem-under-some-windows-desktop-td15868057.html,它描述了我的问题。尝试了那里概述的内容,我确认 Python 可以找到 SVN(它在我的路径中):
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'
看着svnmerge.py
不过,我注意到 python 2.4 及更高版本的代码遵循不同的执行路径。而不是调用
os.popen4() 它使用 subprocess.Popen()。尝试重现该错误:
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新手,但谷歌并没有提供帮助。