[python-win32] Slow COM since Office XP migration

Mark Hammond mhammond at skippinet.com.au
Wed Oct 20 13:25:37 CEST 2004

> I have used the python win32com package succesfully for 
> automating boring Word doc generation. This worked at the 
> speed of light using Word 97. Lately, though, my company 
> upgraded to Office XP. 
> Since then, my python scripts have continued to work fine, 
> but the response time has increased dramatically. This is 
> kind of problematic for me. Quick response time is pivotal to 
> an efficient doc generation.

You should check if you are using early-binding, or "makepy".  It is
possible that as Office has been upgraded and has later type-libraries, you
are now using 'dynamic' objects.  You mention "static COM", but it is not
clear exactly what you mean.

A useful thing is to use win32com.client.gencache.EnsureDispatch() - this
magically runs makepy at runtime, ensuring you always have an early-bound,
makepy generated object.  A repr() of the COM object should make it clear if
you are using makepy generated objects.

Otherwise it is news to me - but unfortunately I don't have office xp, so
can't easily reproduce it.  It would be useful if you can narrow down
exactly what is slower.

> PS: This COM package for python should be placed on the 
> vatican list for sainthood.

Thanks :)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2256 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20041020/e20e450d/winmail.bin

More information about the Python-win32 mailing list