Using COM constants on under IIS ASP.

Mark Hammond MarkH at ActiveState.com
Wed Oct 25 20:09:12 EDT 2000


[Another useful post from Alex]

> D:\Python20\win32com\client>python makepy.py -i
> Acrobat Control for ActiveX
>  {CA8A9783-280D-11CF-A24D-444553540000}, lcid=0, major=1, minor=3
>  >>> # Use these commands in Python code to auto generate .py
support
>  >>> from win32com.client import gencache
>  >>> gencache.EnsureModule('{CA8A9783-280D-11CF-A24D-444553540000}',
0, 1,
> 3)
>

As a tip - if you add "bForDemand=1" to the EnsureModule call, then
you will get much better performance for huge type libraries.  If your
library is small, don't bother, but if it is large, go with this new
option.

In the future, it will probably be the default, and you will need to
turn it _off_ to get the old behaviour.

The new behaviour is that only a small set of stuff is generated at
"EnsureModule()" time - this set includes the constants!  Support for
interfaces are then generated "on demand" - as usage of the interface
is requested - even if that is a different run of your code.  So for
huge type libraries, you pay a much smaller penalty at EnsureModule()
time, and if your app only uses one of 2 of the interfaces in the
library, you _never_ pay the rest of the penalty!  Another minor
advantage is that we never attempt to display a progress bar in this
situation - we assume that the generation will never that as long as
it could before!

Mark.






More information about the Python-list mailing list