Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > makepy generating a file versus a directory

Reply
Thread Tools

makepy generating a file versus a directory

 
 
Olaf Meding
Guest
Posts: n/a
 
      04-29-2004
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
 
Reply With Quote
 
 
 
 
Mark Hammond
Guest
Posts: n/a
 
      04-29-2004
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Mozilla versus IE versus Opera versus Safari Peter Potamus the Purple Hippo Firefox 0 05-08-2008 12:56 PM
gen_py target directory for makepy Alan Meyer Python 0 04-09-2008 03:42 AM
equal? versus eql? versus == versus === verus <=> Paul Butcher Ruby 12 11-28-2007 06:06 AM
makepy generates empty file artem.marchenko@gmail.com Python 0 04-08-2005 10:52 PM
makepy must be run after restart of pythonwin bk Python 0 08-06-2003 03:02 PM



Advertisments