Newbie createing .PYC for import

Oleg Broytmann phd at phd.pp.ru
Thu Mar 1 12:36:53 EST 2001


On Thu, 1 Mar 2001, Larry Bates wrote:
> 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?

import sys
from py_compile import compile

if len(sys.argv) <= 1:
   sys.exit(1)

for file in sys.argv[1:]:
   compile(file)

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list