无法在python中调度com对象 [英] Unable to dispatch com object in python
问题描述
我正试图从名为eSignal的数据提要提供商那里获取交易价格。使用他们在开发人员页面上的示例(链接),我可以轻松地复制C#中的功能。不幸的是,该提供程序不支持python开发人员,因此我尝试自己使用com对象引用中的示例自己执行此操作。但是,由于无法分派有问题的com对象,因此一开始我就已经失败了。
I am trying to capture trading prices from a data feed provider called eSignal. Using their examples on their developer page (Link), I can easily replicate the functionality in C#. Unfortunately the provider does not support python developers and thus I am attempting to do this on my own, using the com object reference in their examples. However, I already fail at the very beginning, since I cannot dispatch the com object in question.
该com对象由eSignal提供(WinSig.exe包含com对象。数据),然后使用makepy(IESignal v.1.0.0)进行了注册:
The com object is provided by eSignal (WinSig.exe contains the com object data) and I registered it using makepy (IESignal v.1.0.0):
C:\Python26\Lib\site-packages\win32com\client>python makepy.py
Generating to C:\Python26\lib\site-packages\win32com\gen_py\9C7CCB46-E9E8-4DDD-9784-4458877C2F10x0x1x0.py
Building definitions from type library...
Generating...
Importing module
因此,模块文件已成功生成。然后,我尝试从python调度它:
So the module file is generated successfully. I then try to dispatch it from python:
from win32com.client import Dispatch
from win32com.client.gencache import EnsureDispatch
CLSID = '{9C7CCB46-E9E8-4DDD-9784-4458877C2F10}'
print Dispatch(CLSID)
但是,这会导致错误:
com_error: (-2147221164, 'Class not registered', None, None)
这种情况发生在Dispatch以及sureDispatch上。我还浏览了makepy生成的模块,并尝试分派其中提供的每个单独的CLSID-无济于事。
This happens for Dispatch, as well as EnsureDispatch. I also went through the module generated by makepy and tried to dispatch every single different CLSID provided in there - to no avail.
有人知道这个问题可能是什么吗?非常感谢您的帮助!
Anybody knows what the issue might be? Your help is much appreciated!
谢谢!
推荐答案
您确定要实例化类(但不是界面)。搜寻uid {9C7CCB46-E9E8-4DDD-9784-4458877C2F10},我已经收到ServerEsignal-它看起来像是界面(IESignal)
Are you sure that you instantiate class (but not Interface). Googling on uid {9C7CCB46-E9E8-4DDD-9784-4458877C2F10} I've gotten ServerEsignal - and it is look like interface (IESignal)
这篇关于无法在python中调度com对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!