[PythonWin] MakePy and gencache.EnsureModule() do different things.

Paul Keating paul.keating at nibcapital.com
Mon Apr 18 06:44:29 EDT 2005


I used MakePy to generate .py support for a COM dll. That created the
file

30D58DAF-B538-45F1-8EFF-F69ABA2BA798x0x1x13.py

I want to be sure that this file is present and so I used MakePy -i to
construct a call to gencache.EnsureModule().

This is what it said:

{30D58DAF-B538-45F1-8EFF-F69ABA2BA798}, lcid=0, major=1, minor=13
 >>> # Use these commands in Python code to auto generate .py support
 >>> from win32com.client import gencache
 >>> gencache.EnsureModule('{30D58DAF-B538-45F1-8EFF-F69ABA2BA798}',
0, 1, 13)

But when I execute this code, it creates the support as a package,
that is, there is a _folder_ called

30D58DAF-B538-45F1-8EFF-F69ABA2BA798x0x1x19

(NB minor version is 19 not 13) with separate .py files for each
interface and class inside, and an __init__.py.

If the EnsureModule() call has not been called to generate the
package, then win32com.client.CastTo() fails when called with a
class-instance and interface defined in the COM dll. It complains that
it can't find the package ...x19.

Can anyone explain the version number difference (I realize that
19=0x13 but that doesn't help me understand it much), the
package/single file difference, and why Dispatch responds to the one,
but CastTo expects the other?



More information about the Python-list mailing list