[mod_python] sys.path problem

Graham Dumpleton graham.dumpleton at gmail.com
Wed Feb 20 20:42:22 EST 2008


Don't use PythonPath directive. Instead, read about the new module
importer in mod_python 3.3.1 which avoids these sort of problems. See
documentation for 'import_module()' in:

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

To explain better, would need to see the exact configuration you are
using for mod_python.

Graham

On 21/02/2008, AJ Coon <ajcoon at gmail.com> wrote:
> Hello,
>
> I have an issue with two different handlers running on the same apache
> server.
>
> They seem to be "sharing" (read: overwriting each other's) sys.path.  I'm
> printing the output of sys.path before any of my import statements in each
> handler to verify this.  It seems like I can make several requests to
> handler "A" with no problem, but then if handler "B" is called, and then
> subsequently handler "A" is called again, sys.path has been overwritten by
> handler "B" for handler "A".  Ugh.
>
> - Each handler is defined in its own virtual host in apache.
> - Each handler is named differently (i.e. PythonHandler handlerA,
> PythonHandler handlerB)
> - Each handler runs in its own sub-directory (i.e. /var/handlerA,
> /var/handlerB)
>  - In the doc root of each handler's virtual host, I have a .htaccess file
> that contains a PythonInterpreter directive, defining a different named
> interpreter to be used (i.e. PythonInterpreter InterpA, PythonInterpreter
> InterpB)
>
>
> How can I ensure that each handler has its own sys.path that is not affected
> by the other handler, ever?
>
>
> I am running on the following stack:
>
> Apache/2.0.54 (Debian GNU/Linux) mod_python/3.3.1 Python/2.3.5
> mod_ssl/2.0.54 OpenSSL/0.9.7e
>
>
> Thanks,
> -aj
>
> _______________________________________________
>  Mod_python mailing list
>  Mod_python at modpython.org
>  http://mailman.modpython.org/mailman/listinfo/mod_python
>
>


More information about the Mod_python mailing list