[python-win32] Using COM Event. A problem
NIcola Montecchiari
omega.centauri at gmail.com
Wed Dec 6 10:51:37 EST 2017
Dear All,
I am trying to create a call back for som events generated by a COM server
that I connect.
Looking at some posts apparently related to the same topic, I wrote this
sample code to test:
import win32com.client as com
from win32com.client import gencache
class Eventi:
def Device_Notify(self,EventCode):
if EventCode==0:
print "begin"
elif EventCode==1:
print "end"
mod = gencache.EnsureModule('{B4955EC7-F7F2-11D2-AA9C-444553540000}', 0, 1,
0)
ob = mod.Application()
objCybio = com.DispatchWithEvents(ob, Eventi)
When I run this code, it starts the connection, but soon after it is
stopped with the following error:
Traceback (most recent call last):
File "evento.py", line 13, in <module>
objCybio = com.DispatchWithEvents(ob, Eventi)
File "D:\Python27\lib\site-packages\win32com\client\__init__.py", line
256, in
DispatchWithEvents
raise TypeError("This COM object can not automate the makepy process -
please run makepy manually for this object")
TypeError: This COM object can not automate the makepy process - please run
makepy manually for this object
I did run the makepy, but still the same error.
Do you have any suggestion of what it could be wrong?
Thanks a lot for your help
Nicola
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20171206/bafec2f3/attachment.html>
More information about the python-win32
mailing list