[mod_python] Python Path

Robert Sherwood rsherwood at cryptoknights.com
Wed Jan 16 12:30:22 EST 2002


Greetings all:

Someone is going to kick me, but I know I'm overlooking something
obvious and I was hoping one of you could spot it.

I am trying to have my main PythonHandler import a module that is below
it in the directory tree. Here is the basic information:

=========================================================

0. mod_python 2.7.6 running on debian unstable, using python-2.1.1

1. Scripts located in and below "/var/python"

2. mod_python listening on an apache VirtualHost

3. Config file as follows:
  Listen 8080
  <VirtualHost beelzebub:8080>
    DocumentRoot /var/python
    PythonPath "['/var/python/'] + sys.path"
    PythonDebug On
    PythonAutoReload On
    SetHandler python-program
    PythonTransHandler trans
    PythonHandler main
  </VirtualHost>

4. Python handler main failing at this directive:

  File "/var/python/main.py", line 3, in ?
     import browse.listArtists

  ImportError: No module named browse.listArtists

5. ls -F /var/python

admin/	 data/	  main.pyc  objects/	 playlists/    template/  trans.pyc 
browse/  main.py  mod_mp3/  parseRDF.py  preferences/  trans.py

6. ls -F /var/python/browse

__init__.py  listArtistAlbumSongs.py  listArtistAlbums.py 
listArtists.py

========================================================

I can't figure it out. It is as if the PythonPath directive were not
being inherited by the interpreter running main.py. Is this a bug, or am
I stupid?

Or both :)

Thanks in advance for any help anyone can offer.

Robert Sherwood




More information about the Mod_python mailing list