【发布时间】:2016-11-23 17:59:40
【问题描述】:
我正在尝试使用 python win32com 打开 CANoe 应用程序,但出现以下错误
Traceback (most recent call last):
File "C:\Users\20044033\Desktop\test.py", line 2, in <module>
xl = win32com.client.Dispatch ('CANoe.Application')
File "C:\Python27\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python27\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)
com_error: (-2147221005, '无效的类字符串', None, None)
而其他应用程序(如 excel)则没有此类错误。 从其他 stackoverflow 答案中,我了解到只能访问 COM 注册的应用程序。
如何将 CANoe 添加到已注册的 COM 对象列表中?
【问题讨论】:
-
不提供MCVE 无济于事,但据我所知,CANoe 在安装过程中会自行注册,所以我怀疑这是原因,除非您在安装过程中出现问题。
-
您找到解决方案了吗?
标签: python python-2.7 com win32com canoe