Fabian Fagerholm
fabbe at paniq.net
Mon Aug 19 12:21:43 EST 2002
Continuing to explore mod_python, I'm having trouble with package notation in the PythonHandler directive. I'm looking at the mod_python docs, and the Tutorial section 3.2 in particular. It suggests that you could have a directory structure as follows: <your base dir> | +- .htaccess (file) +- subdir (directory) | +- myscript.py (file) The .htaccess file would look as follows: AddHandler python-program .py PythonHandler subdir.myscript and the myscript.py file in the 'subdir' subdirectory would look as follows: from mod_python import apache def handler(req): req.content_type = "text/plain" req.send_http_header() req.write("Hello, World!") return apache.OK If I do this, I get a 500 Internal Server Error and the following appears in the apache logs: [Mon Aug 19 12:12:57 2002] [error] PythonHandler subdir.myscript: Traceback (most recent call last): [Mon Aug 19 12:12:57 2002] [error] PythonHandler subdir.myscript: File "/usr/lib/python2.1/site-packages/mod_python/apache.py", line 181, in Dispatch module = import_module(module_name, _req) [Mon Aug 19 12:12:57 2002] [error] PythonHandler subdir.myscript: File "/usr/lib/python2.1/site-packages/mod_python/apache.py", line 332, in import_module f, p, d = imp.find_module(parts[i], path) [Mon Aug 19 12:12:57 2002] [error] PythonHandler subdir.myscript: ImportError: No module named subdir What am I doing wrong? Cheers, Fabian
|