[python-win32] win32com and DispatchWithEvents()

Mark Hammond mhammond at skippinet.com.au
Sat Nov 15 00:38:22 CET 2008


> haObj = win32com.client.DispatchWithEvents("HAWin32", HAEvents) 
> It fails with the error message: 
> "TypeError: This COM object can not automate the makepy process - please 
> run makepy manually for this object" 

At this point, all you need to do is execute makepy, then select the typelib
for your object.  Once executed, you can then try the DispatchWithEvents
line again - there isn't a need to use EnsureModule yet.

If you *do* get that working, then you should try running "makepy.py -i" and
re-selecting the typelib - that will then spit out some 'EnsureModule' lines
you could use to automate the makepy process.

> http://mail.python.org/pipermail/python-win32/2006-August/004888.html

hrm - its quite possible that there are objects we can do events for, but
those objects do *not* provide typeinfo at runtime.  We could probably
handle this situation, but unfortunately I'm not in a position to test
things.  Ultimately, the message comes from a block in
win32com\client\__init__.py:

    except pythoncom.com_error:
      raise TypeError("This COM object can not automate the makepy process -
please run makepy manually for this object")

It might be informative to remove that exception handler so we can see what
the original exception raised by the object was.

Cheers,

Mark



More information about the python-win32 mailing list