当前位置: 动力学知识库 > 问答 > 编程问答 >

python load windows COM interface

问题描述:

I registered a C# COM interface dll

Using

"c:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /codebase StepsToEveConverter.dll

Microsoft .NET Framework Assembly Registration Utility version 4.0.30319.34209

for Microsoft .NET Framework version 4.0.30319.34209

Copyright (C) Microsoft Corporation. All rights reserved.

RegAsm : warning RA0000 : Registering an unsigned assembly with /codebase can cause your assembly to interfere with other applications that may be i

talled on the same computer. The /codebase switch is intended to be used only with signed assemblies. Please give your assembly a strong name and re

egister it.

Types registered successfully

I have installed python

When I type python.exe at command prompt it shows:

Python 3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:16:59) [MSC v.1900 32 bit (Intel)] on win32

Type "copyright", "credits" or "license()" for more information.

The pyhon paths in my Eclipse tool

To test COM functionality i used

w=win32com.client.Dispatch("Word.Application")

w.Visible=1

Who opens Word as expected

But when i try to use my COM dll StepsToEveConverter.dll i get

from comtypes.client import CreateObject

eveConverter = CreateObject("StepsToEveConverter");

Gives error:

...

_ole32.CoCreateInstance(byref(clsid), punkouter, clsctx, byref(iid), byref(p))

File "_ctypes/callproc.c", line 945, in GetResult

WindowsError: [Error -2147221164] Class not registered

In regedit.exe HKEY_CLASSES_ROOT i have the entry

网友答案:

After i installed 32 bit version of Anaconda it works with this

import comtypes
import comtypes.client
eveConverter = comtypes.client.CreateObject("StepsToEveConverter");
分享给朋友:
您可能感兴趣的文章:
随机阅读: