0
comtypes를 사용하여 Python 코드에서 사용하려고하는 COM에 등록 된 C# DLL이 있는데이 코드는 컴퓨터에서 완벽하게 작동합니다. C# dll을 개발 중이지만 모든 필요한 파일을 가진 다른 기계. 여기 Python Comtypes CreateObject에 오류가 발생했습니다.
내가Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\bellagio\DriverManager\audiotest\apx525\apx525_Wrapper.py", line 257, in <module>
c._Connect()
File "C:\Python27\Lib\site-packages\bellagio\DriverManager\audiotest\apx525\apx525_Wrapper.py", line 51, in _Connect
self.apx525 = CreateObject("APxWrapper.APxWrapper",None,None,apx.IAPxWrapper)
File "C:\Python27\lib\site-packages\comtypes\client\__init__.py", line 235, in CreateObject
obj = comtypes.CoCreateInstance(clsid, clsctx=clsctx, interface=interface)
File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 1145, in CoCreateInstance
_ole32.CoCreateInstance(byref(clsid), punkouter, clsctx, byref(iid), byref(p))
File "_ctypes/callproc.c", line 936, in GetResult
WindowsError: [Error -2147024894] The system cannot find the file specified
무엇입니까 오류이며, 해당 파이썬 코드는 폴더가 3 개 파일 ApxWrapper.tlb .APxWrapper.dll 및 종속성 DLL을 가지고
try:
from comtypes.client import CreateObject,GetModule, Constants, GetEvents
from comtypes import COMError
GetModule("P:\\Share\\Test\\TestBed\\Bellagio\\dll\\APxWrapper.tlb")
from comtypes.gen import APxWrapper as apx
except:
tblog.warnLog("Need to install comtypes package, AP driver not imported")
class IAPxWrapper_Impl(object):
def __init__(self):
self.apx525 = None
self.activeSignalPath = ''
self.activeMeasurement = ''
def _Connect(self):
self.apx525 = CreateObject("APxWrapper.APxWrapper",None,None,apx.IAPxWrapper)
self.apx525._GUIVisible = True;
return True
c = IAPxWrapper_Impl()
c._Connect()
주입니다. GetModule 잘 작동하고 문제가 시스템 모두에서 참조 닷넷 DLL의 버전이 매우
산 제이