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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Keating

    #1

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

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

    30D58DAF-B538-45F1-8EFF-F69ABA2BA798x0x 1x13.py

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

    This is what it said:

    {30D58DAF-B538-45F1-8EFF-F69ABA2BA798}, lcid=0, major=1, minor=13[color=blue][color=green][color=darkred]
    >>> # Use these commands in Python code to auto generate .py support
    >>> from win32com.client import gencache
    >>> gencache.Ensure Module('{30D58D AF-B538-45F1-8EFF-F69ABA2BA798}',[/color][/color][/color]
    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-F69ABA2BA798x0x 1x19

    (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?
Working...