Newbie createing .PYC for import

Steve Holden sholden at
Thu Mar 1 18:44:16 CET 2001

"Larry Bates" <lbates at> wrote in message
news:3a9e83fa$1 at
> I have spent the last couple of hours (unsuccessfully) attempting to
> out how to generate a .PYC file for a module that I've defined.
> 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
> -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


More information about the Python-list mailing list