[mod_python] psp_site example doesn't work

Graham Dumpleton grahamd at dscpl.com.au
Mon Jan 24 07:00:01 EST 2005

On 24/01/2005, at 6:09 PM, Nicolas Lehuen wrote:
>> The consequences of this are that if requests cycle between the two
>> versions of "index.py", on every access there will be a module reload.
>> This will be inefficient at least, but worse problems could arise if 
>> the
>> two instances of the module use similar names for global variables.
>> Package such as mpservlets and Vampire implement their own module
>> importing mechanisms in order to avoid this problem. Ie., with those
>> packages it is safe to have Python code files which are named the same
>> appearing in different directories managed by mod_python running
>> under the same interpreter.
> We had a discussion a few months ago about this issue, and I still
> think it's a bug. Like Daniel Popovitch with mpservlets and you with
> Vampire, I had to implement my own import mechanism to work around the
> bug. I think it's time to fix it... I'll add a bug report and see what
> we can do about it.

Probably a good thing. All my implementations of my module import system
however have worked on specifying the exact directory that the module
was expected to reside in. Thus I wasn't having to deal with the 
of using sys.path and the unpredictability of which module you will pick
up if there are commonly named ones. I will thus have to have a good 
about how the mod_python one can be fixed and retain the same interface.
I can see a partial solution in my head, but not yet a complete one. :-)

Do we need to document properly first the perceived problems and some
examples of errornous behaviour? This will help to ensure we fix
everything and provide a basis for some tests of any new implementation.
I know that such information can be noted against the bug tracker item,
but is it easier to thrash it out here first.

In the back of my head, am thinking that relying on a search through
sys.path is always going to be problematic. Do we want to also consider
any alternative interfaces styles to module importing and caching. 
provide a parallel implementation that requires the exact directory to
be specified and if this proves better, promote a migration to this
style of interface while keeping the old.


More information about the Mod_python mailing list