makepy generating a file versus a directory

Discussion in 'Python' started by Olaf Meding, Apr 29, 2004.

  1. Olaf Meding

    Olaf Meding Guest

    When does the makepy utility generate a .py file and when a directory?
    And what decided if a directory or a file is generated?

    What is the difference between a file and a directory (both named
    after the uuid in the IDL file)?

    Most of the time the code below generates a file called
    BF79B6C5-47BE-11D2-BACD-006008060A3A.py. But one time it generated a
    directory with that same name. This directory contained several .py
    files.

    Both the .py file and the directory are generated at:
    "C:\Python23\Lib\site-packages\win32com\gen_py".

    Here is the Python code:
    from win32com.client import gencache
    gencache.EnsureModule('{BF79B6C5-47BE-11D2-BACD-006008060A3A}', 0,
    1, 0)

    Thanks so much for your help.

    Olaf
    Olaf Meding, Apr 29, 2004
    #1
    1. Advertising

  2. Olaf Meding

    Mark Hammond Guest

    Olaf Meding wrote:
    > When does the makepy utility generate a .py file and when a directory?
    > And what decided if a directory or a file is generated?


    Whenever 'bForDemand' is passed to the gencache/makepy functions.
    Currently EnsureDispatch passes True here.

    > What is the difference between a file and a directory (both named
    > after the uuid in the IDL file)?


    I am moving towards the directory version. In this case, only the
    package itself (with the __init__.py) is generated when the tlb is
    loaded. Interfaces etc referenced in the typelib are then generated 'on
    demand', as they are referenced.

    The benefit is for huge type-libraries, when only one or 2 interfaces
    are used. A good example is Excel - often you just use 2 or 3
    interfaces, but the .tlb, and generated .py file, is huge. The cost of
    bringing in the .pyc can be quite high for these typelibs, let alone the
    generation of it first time around.

    Mark.
    Mark Hammond, Apr 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    6,894
    Scott M.
    Oct 11, 2003
  2. Russ

    script versus code versus ?

    Russ, Jun 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,482
  3. Replies:
    0
    Views:
    239
  4. Alan Meyer

    gen_py target directory for makepy

    Alan Meyer, Apr 9, 2008, in forum: Python
    Replies:
    0
    Views:
    650
    Alan Meyer
    Apr 9, 2008
  5. Paul Butcher
    Replies:
    12
    Views:
    693
    Gary Wright
    Nov 28, 2007
Loading...

Share This Page