PEP 304 - Controlling generation of bytecode files

Dennis Reinhardt DennisR at
Tue Jan 28 15:39:46 CET 2003


I got a 404 error.  This URL works for me:

Why not "pyc_dir" as a shorter name?

This PEP does not address explicitly how the user can change the env.
variable during startup. Suppose I code in my main module:

    sys.pythonbytecodebase = ""
    import file01
    import file02
    sys.pythonbytecodebase = "outdir/subdir"
    import file03
    ....  #etc.

does this give file by file control?

What I would really want is directory by directory control.  I am importing
from the following example structure


I would like a clean way to treat pyc files in dirA one way and dirB another
without chasing down every import.  For example:

    sys.pyc_dir = {"dirA":"", dirB:"output/dir/path", ".":"some/other/path"}

once at the beginning would give all the control I would want.  Perhaps
there is a way to incorporate file by file control in a single statement

Dennis Reinhardt

DennisR at

More information about the Python-list mailing list