[mod_python] importing modules in PSP

.: smilelover :. smilelover at centrum.cz
Mon Jan 30 17:15:45 EST 2006

Hi, another question ;)
in classic CGI I can import a .py file that lies in the same directory as  
an ordinary module. e.g. if I have files index.py and foo.py, I can put  
"import foo" in index.py and it works.
Nevertheless, in PSP it doesn't work :( when I write:

import time

if form.has_key('name'):
    greet = 'Hello, %s!' % form['name'].capitalize()
    greet = 'Hello there!!!'


it works, because the time module is in the python path. But when I do:

import foo


where foo.py is a file placed in the same dir as the psp file, I get  
"ImportError: No module named foo" error.

Is it so that in plain PSP I can use only <%@ include file='filename'>  
directive and when I want to make use of regular importing, I better use  
templating principle where I create regular .py files and do importing?


More information about the Mod_python mailing list