[mod_python] Undocumented (?) change in PythonPath for 3.0 vs 2.7

Gregory Bond gnb at itga.com.au
Thu Mar 11 13:05:51 EST 2004


In mod_python 2.7, I could do this:

  <Directory /mywebdir>
    AddHandler python-program .py
    PythonDebug On
    PythonPath "['/mywebdir'] + sys.path"
    <Files "prog1.py"
      PythonHandler prog1
    </Files>
    <Files "prog2.py"
      PythonHandler prog2
    </Files>
  </Directory>

but under 3.0 this doesn't work - the PythonPath directive seems to not be 
noticed, as accessing "/prog1.py" returns an ImportError.

But if I do this under 3.0:

  <Directory /mywebdir>
    AddHandler python-program .py
    PythonDebug On
    <Files *.py>
      PythonPath "['/mywebdir'] + sys.path"
    </Files>
    <Files "prog1.py"
      PythonHandler prog1
    </Files>
    <Files "prog2.py"
      PythonHandler prog2
    </Files>
  </Directory>

(i.e. put the PythonPath inside a <Files *.py>) this works.

Wierd!

I've not yet tried with 3.1.3 - hopefully next week.

(FAQ 3.4 updated.)




More information about the Mod_python mailing list