MS COM early and late binding

Mark Hammond mhammond at keypoint.com.au
Tue Apr 27 19:31:09 EDT 2004


Olaf Meding wrote:

> Is there a way to find out if I am using early or late binding given
> the reference ("excel" in the example below) returned by Dispatch()?
> 
> 
>>>>import win32com.client
>>>>excel = win32com.client.Dispatch('Excel.Application')

There is no great way to find out (other than looking at the repr() of 
the object or trying Thomas's trick), but there is a way to force one or 
the other.

excel = win32com.client.gencache.EnsureDispatch(excel)

Will ensure you have early bound, executing makepy if necessary.

excel = win32com.client.dynamic.DumbDispatch(excel)

Will force late bound, even if the object is currently early.

Mark.



More information about the Python-list mailing list