PEP 304 - Controlling generation of bytecode files

Dennis Reinhardt DennisR at dair.com
Tue Jan 28 09:39:46 EST 2003


>     http://www.python.org/dev/peps/pep-0304.html

I got a 404 error.  This URL works for me:
http://www.python.org/peps/pep-0304.html

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

    dirA
      +--dirB

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
also.
--

Dennis Reinhardt

DennisR at dair.com
http://www.dair.com






More information about the Python-list mailing list