Question concerning makepy.py for COM

Toby Dickenson tdickenson at geminidataloggers.com
Thu Feb 10 05:38:14 EST 2000


Scott Anderson <sanderson at ttm.com> wrote:

>mhammond at skippinet.com.au wrote:
>> You dont need to do anything special - just call
>> "win32com.client.Dispatch(prog_id)" and it should work.
>
>That's dynamic dispatch. I was under the impression that makepy
>generated a Python module suitable for doing static dispatch...

win32com.client.Dispatch chooses the best form of dispatch out of all
those available. Its preferred choice it to use makepy's output, if
its available.

If you want to force dynamic dispatch, use
win32com.client.dynamic.Dispatch 

If you want to force use of the makepy output, the best thing to do is
copy the module from makepy's cache directory, give it a sensible
name, possibly add it to your revision control system, and import it
directly. In your case:

import scotts_controls
o = scotts_controls.TSHSWAPI()

If you choose this latter option then you should be aware that you
will not be able to use the easier of the two Event support options
provided by win32com.client, DispatchWithEvents. You will have to use
the lower level getevents. 



Toby Dickenson
tdickenson at geminidataloggers.com



More information about the Python-list mailing list