python调用接口失败_python调用软件com接口问题,python报错 -问答-阿里云开发者社区-阿里云…

  • Post author:
  • Post category:python


没有任何错误描述,谁会去下你那几百M的东西给你试。

首先,你要去下载安装pywin32这个库:https://sourceforge.net/projects/pywin32/files/pywin32

确保安装没问题,然后确宝你的COM组件是存在的,如果只有个dll文件可以先用regsvr32命令安装。

然后应该没问题,如果实在不行,先用别的语言比如C++把你的COM调用包成一个dll文件,然后再通过ctypes调用你的dll也是可以的。######

实在不好意思没附上问题描述,第一次论坛问问题。有很多dll文件试着用regsvr32命令安装了如图中的,提示找不到入口点DllRegisterServer

问题描述:

Traceback (most recent call last):

File “C:\Users\Administrator\Desktop\develop\load.py”, line 14, in

Vissim = com.Dispatch(“Vissim.Vissim”)

File “D:\Python\lib\site-packages\win32com\client\__init__.py”, line 95, in Dispatch

dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)

File “D:\Python\lib\site-packages\win32com\client\dynamic.py”, line 114, in _GetGoodDispatchAndUserName

return (_GetGoodDispatch(IDispatch, clsctx), userName)

File “D:\Python\lib\site-packages\win32com\client\dynamic.py”, line 91, in _GetGoodDispatch

IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)

com_error: (-2147221164, ‘\xc3\xbb\xd3\xd0\xd7\xa2\xb2\xe1\xc0\xe0’, None, None)