Newbie createing .PYC for import

Steve Holden sholden at holdenweb.com
Thu Mar 1 12:44:16 EST 2001


"Larry Bates" <lbates at syscon-computers.com> wrote in message
news:3a9e83fa$1 at news1.dbtech.net...
> I have spent the last couple of hours (unsuccessfully) attempting to
figure
> out how to generate a .PYC file for a module that I've defined.
Everything
> appears to imply that it's "automatic", but I'm not getting anywhere.  I
> have a module and I wish to generate a .PYC file so that I can import it
> into future projects.  Can anyone shed any light on how to accomplish
this?
>
> -Larry
>
When a module is imported for the first time (or when the source is more
recent than the current compiled file) a .pyc fileshould be created, in the
same directory as the .py file, containing the compiled code.

If your .pyc's aren't being created, this is probably a permissions problem
with the directory, or similar. This can happen, for example, if you develop
as one user but run as another, such as if you are testing with a web
server.

regards
 Steve






More information about the Python-list mailing list