[mod_python] Different scripts with same names and sys.path confusion

Nicolas Lehuen nicolas.lehuen at gmail.com
Fri Jan 20 13:13:49 EST 2006


Hi Jure,

This is a very well know bug of mod_python.publisher that has been
fixed in the 3.2 version (whose final release should be made really
really soon now).

As a work around you can try to define two different PythonInterpreter
names for each application (for example in a .htaccess file at the
root of each application). This way your two applications will run
into different Python interpreters and you should see your problem
disappear.

Regards,
Nicolas

2006/1/20, Jure Vrscaj <jure at dijaski.net>:
> Hello,
>
> I'm working on a web-based gui for some application in mod_python, using
> publisher as a request handler. The project was going on ok, until I
> made a copy of the application, so that one copy could be used for
> testing/development and the other for real usage. But, as soon as two
> copies existed on the same server, one being requested after another, I
> noticed some strange effects:
>
> At first, every now and then, I got a "404 Not Found" error when
> requesting one of the two copies. I traced the error which was raised in
> apache.py, the reason being that the module's directory I was trying to
> access wasn't in the path(which is calculated from request url). I
> commented out the check, and tried again. Now the error was gone, but
> another issue arised: when requesting for example the development page,
> which has the title set to "Test", instead of seeing the correct title,
> I got (seemingly randomly) titles from both the test site and the real one.
>
> I figured that wrong modules are being used/imported and made the script
> output sys.path. The path contained both: root folder of the testing
> site and next to it root folder of the real site, which was probably the
> reason why the titles were unstable. I tried setting PythonPath, with no
> effect.
>
> My system specs are:
> - redhat linux
> - httpd-2.0.46-54.ent (apache2.0)
> - python-2.2.3-6.1
> - mod_python-3.0.3-5.ent
> - handler: mod_python.publisher
>
> I would use Vampire, but couldn't get it to work on python2.2.
>
> Any suggestions on how to overcome this problem really appreciated, I
> don't mind if each module is reloaded for every request, as long as it's
> the right module. (the application is using classic python import
> command for module importing)
>
> regards,
> jure
> _______________________________________________
> 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