By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,526 Members | 1,618 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,526 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.