>   When I run this, I get the following error:
>
> Traceback (most recent call last):
>   File "C:\Program
> Files\Python24\Lib\site-packages\pythonwin\pywin\framework\scr
> iptutils.py",
> line 310, in RunScript
>     exec codeObject in __main__.__dict__
>   File "C:\Documents and Settings\benn\Desktop\cybio
> test.py", line 9, in ?
>     objCybio =
> win32com.client.DispatchWithEvents("OpalControl.Application",
> CybioEvents)
>   File "C:\Program
> Files\Python24\Lib\site-packages\win32com\client\__init__.py",
>  line 254,
> 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

The problem will be that the object itself doesn't supply the typeinfo
necessary to associate the object with the makepy generated class.  It
should however be possible for you to manually extract a suitable object
though.

What you need is something like:

from win32com.client import gencache
mod = gencache.EnsureModule(...) # use 'makepy -i' to see the params
ob = mod.Application()
objCybio = win32com.client.DispatchWithEvents(ob, CybioEvents)

'mod' will be a reference to the makepy generated module.  Assuming this
module defines a class called 'Application', 'ob' should be an instance of
the COM object, but with makepy support.  Passing this object to
DispatchWithEvents instead of the CLSID means the type info is available.

Hope this helps,

Mark

_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to