Precimpiling *.py to *.pyc.
Fredrik Lundh
effbot at telia.com
Tue Sep 26 15:03:03 EDT 2000
Thaddeus L. Olczyk wrote:
> Is there any way of compiling all the *.py to *.pyc files?
sure: use the compileall module!
>>> import compileall
>>> print compileall.compile_dir.__doc__
Byte-compile all modules in the given directory tree.
Arguments (only dir is required):
dir: the directory to byte-compile
maxlevels: maximum recursion level (default 10)
ddir: if given, purported directory name (this is the
directory name that will show up in error messages)
force: if 1, force compilation, even if timestamps are up-to-date
>>> compileall.compile_dir("mydir")
Listing mydir ...
Compiling mydir\foo.py ...
...
>>> print compileall.compile_path.__doc__
Byte-compile all module on sys.path.
Arguments (all optional):
skip_curdir: if true, skip current directory (default true)
maxlevels: max recursion level (default 0)
force: as for compile_dir() (default 0)
</F>
More information about the Python-list
mailing list