Running the makepy tool automatically from a python script

Peter Hansen peter at engcorp.com
Mon Jun 21 16:30:53 EDT 2004


Svenn-Ivar Svendsen wrote:

> I use the makepy tool in pythonwin to generate wrappers for my
> connection point (event) interfaces in a project. It works fine.
> The question is; Is it possible, in a python script, to detect if
> wrappers for COM (event) interfaces the script uses have been created,
> and in case not somehow call the makepy tool manually before
> proceeding? How should this be done?

Run makepy.py manually with the "-i" option first, and it will
give you this sort of output:

PeterTest 1.0 type library
  {7FAE1795-E030-401D-BCD9-C05CC1D318EC}, lcid=0, major=1, minor=0
  >>> # Use these commands in Python code to auto generate .py support
  >>> from win32com.client import gencache
  >>> gencache.EnsureModule('{7FAE1795-E030-401D-BCD9-C05CC1D318EC}', 0, 
1, 0)

Does that help?  (Basically, you need the GUID for the type library,
and the LCID and version major/minor numbers, and just pass them
to EnsureModule() as above.)

-Peter



More information about the Python-list mailing list