2013-10-15 3 views
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의 버전이 매우

산 제이

답변

0

감사이었다에 어떤 힌트, 파이썬은 어떻게 든하지 않습니다 pyton 파일은 comtypes.gen 폴더에 생성됩니다 완전한 오류 세부 사항을 제공하고, 나는 샘플 C# 응용 프로그램을 작성하여 실행하고 C# 예외가 발생하여 모든 필요한 정보를 얻을 수있었습니다.

관련 문제