[mod_python] importing woes

Todd Boland itodd at itodd.org
Sun Sep 19 22:50:08 EDT 2004


Please allow myself to introduce ... myself. I'm Todd and I'm in love 
with python. I'm a newbie so please excuse me if the answer to my woes 
is obvious.

I'm setting up an environment for my first mod_python project. It's a 
radio-pharmacy manager (not redhat package manager) which lives at /rpm 
on my file system. The following code raises the exception: 
"ImportError: No module named RPM."

in httpd.conf, i have:
PythonPath "sys.path+['/rpm/lib']"

the code:
from mod_python import apache, psp
from RPM import database

def index(req, result='success'):
         template = psp.PSP(req, filename='test.html')
         template.run({'result':result})

Why can I do the following on the command line without an exception 
being raised?

itodd at powerbook ~] python
Python 2.3.4 (#1, Sep 17 2004, 11:09:35)
[GCC 3.1 20021003 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
 >>> import sys
 >>> sys.path.append('/rpm/lib')
 >>> from RPM import database
 >>> database
<module 'RPM.database' from '/rpm/lib/RPM/database.pyc'>
 >>>



More information about the Mod_python mailing list