The compileall Module

The compileall module (see Example 13-11) contains functions to compile all Python scripts in a given directory (or along the Python path) to byte code. It can also be used as a script (on Unix platforms, its automatically run when Python is installed).

Example 13-11. Using the compileall Module to Compile All Scripts in a Directory
File: compileall-example-1.py

import compileall

print "This may take a while!"

compileall.compile_dir(".", force=1)

This may take a while!
Listing . ...
Compiling .SimpleAsyncHTTP.py ...
Compiling .aifc-example-1.py ...
Compiling .anydbm-example-1.py ...
...

Core Modules

More Standard Modules

Threads and Processes

Data Representation

File Formats

Mail and News Message Processing

Network Protocols

Internationalization

Multimedia Modules

Data Storage

Tools and Utilities

Platform-Specific Modules

Implementation Support Modules

Other Modules



Python Standard Library
Python Standard Library (Nutshell Handbooks) with
ISBN: 0596000960
EAN: 2147483647
Year: 2000
Pages: 252
Authors: Fredrik Lundh

Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net