t1746476939
t1746476939
2017-12-17 13:10

python怎样调用和注册dll或com组件

160
  • python
  • com组件
  • 插件

我尝试调用大漠插件代码如下
import win32com.client
dm = win32com.client.Dispatch('dm.dmsoft')
print(dm.Ver())

报错如下:

F:\soft\python\python.exe F:/python_work/test_dir/test.py
Traceback (most recent call last):
File "F:\soft\python\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221021, '操作无法使用', None, None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "F:/python_work/test_dir/test.py", line 9, in
dm = win32com.client.Dispatch('dm.dmsoft')
File "F:\soft\python\lib\site-packages\win32com\client__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "F:\soft\python\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "F:\soft\python\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221164, '没有注册类', None, None)

请大神们详细指点下怎样操作 本人小白一个
跪谢!!
QQ:1746476939

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

6条回答

为你推荐