[python-win32] Re: problems in returning parameters using a COM client

Mark Hammond mhammond@skippinet.com.au
Sat, 21 Dec 2002 10:11:11 +1100

Try running makepy over the Corel object, or better, use
win32com.client.gencache.EnsureDispatch() in place of
win32com.client.Dispatch to create the object.

>   File "<COMObject CorelDraw.automation.6>", line 2, in

This implies your object is not using makepy - EnsureDispatch() should force
that.  However, if upon doing that you still get the same error, with the
COM object being printed as "<COMObject ...>", then corel sucks and you must
jump some extra hoops.  These hoops will look something like:

cd_mod = gencache.EnsureModule(...)
cd = Dispatch("CorelDraw.Automation")
print repr(cd) # Will print "<COMObject CorelDrawautomation.6>"
cd = cd_mod.Application(cd)
print repr(cd) # Will print "<win32com.genpy....>"

cd should now work correctly.  Lotus notes has this same problem, so
googling for "EnsureModule notes" is likely to find some good hits - but
hopefully just switching to EnsureDispatch() will get everything working
with byrefs.