我创建了一个python脚本(打包为post-commit.exe)作为SVN post commit钩子运行。是的,钩子运行,但这是我遇到的问题:
App = win32com.client.GetActiveObject("EA.App")
此问题在Windows 7上不会发生,但现在在具有相同安装的Windows Server 2012 R2上发生:
的TortoiseSVN-1.9.0.26652-x64的svn的-1.9.0.msi
pywin32-220.win-AMD64的py3.3.exe
蟒-3.3.0.amd64.msi
我使用pip显式安装pypiwin32,但我不知道它是否真的有效(或者它是否重要)。它说它已安装,但在安装结束时,即使我以管理员身份运行,它也会给我以下内容:
PermissionError: [Errno 13] Permission denied: 'c:\\python33\\Lib\\site-packages\\pythoncom.py'
当我打开这个.exe它运行正常并按预期工作,但当它被实际的SVN提交启动时,SVNTortoise给出了下面的错误消息。我有SVN删除其他代码行的PATH的问题,所以我也尝试了EA.exe所在的完整路径。我运行了wmic获取ProcessID并尝试了给我的东西......但这些都不起作用:
App = win32com.client.GetActiveObject(r"C:\Program Files (x86)\Sparx Systems\EA\EA.App")
App = win32com.client.GetActiveObject(r"C:\PROGRA~2\SPARXS~1\EA\EA.App")
非常感谢任何帮助。我花了很多时间谷歌搜索和搜索stackoverflow的答案,但找不到任何针对这个特定问题。谢谢!
SVN错误输出:
post-commit hook failed (exit code -1) with output:
Traceback (most recent call last):
File "ATC_Generator.py", line 58, in <module>
File "site-packages\win32com\client\__init__.py", line 78, in GetActiveObject
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ATC_Generator.py", line 61, in <module>
File "site-packages\win32com\client\__init__.py", line 95, in Dispatch
File "site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
File "site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
Failed to execute script ATC_Generator