[mod_python] Problems w/ mod python

Graham Dumpleton graham.dumpleton at gmail.com
Thu Apr 17 17:02:06 EDT 2008


2008/4/18 Joseph Bernhardt <joe at incomps.com>:
>
>
>
>
> 1) How do I import a file in the same folder as the script which is
> importing? This does not work:
>
> Is this directory in your module path?  sys.path

In mod_python 3.3.1 that is not necessarily the right answer. This is
because script files, such as those for mod_python.publisher are
loaded with mod_python module importer. This has its own concept of
path and you should not add one of those directories to sys.path and
create an overlap.

Either the OP's module is not readable to Apache user, or it is
actually a package, in which case it needs to be moved out of document
tree and then sys.path extended with directory it was put in.

See documentation for import_module() in:

  http://www.modpython.org/live/current/doc-html/pyapi-apmeth.html

Graham


More information about the Mod_python mailing list