[mod_python] PythonInterpPerDirec* Question

Graham Dumpleton grahamd at dscpl.com.au
Wed Sep 14 22:36:18 EDT 2005

The changes to fix the PythonInterpPerDirective bug were in a few
different places in the code and I can't recollect exactly what
they were. It would be easier if you try 3.2 beta versions. These
are available from:


I haven't caught up on all my email yet, but beta testing is coming
to a close and the latest beta will possibly be close if not what
will be released.


On 13/09/2005, at 6:04 AM, Huzaifa Tapal wrote:

> Thanks for the info Graham.  I had definitely made sure that I was 
> getting into the Directory directive, however, the 
> PythonInterpPerDirective was not bein honored.
> As for the bugs with the PythonInterpPerDirective directive, I see in 
> the comments that the problem outlined have been patched.  Is there a 
> way to get that patch to be applied to my current version of 
> mod_python?
> Hozi
> Graham Dumpleton wrote:
>> On 09/09/2005, at 7:46 AM, Huzaifa Tapal wrote:
>>>  Hello all,
>>>  I have a question about the usage of the PythonInterpPerDirectory 
>>> and PythonInterpPerDirective directives.  I am trying to setup a 
>>> development box with mod_python support, and want to set it up in a 
>>> way so that different users, within their cgi-bin can have multiple 
>>> mod_python handler installations and each handler having its own set 
>>> of sub-interpreters.  After doing some research I found that the 
>>> usage of the above two directives is the solutions (or maybe 
>>> something else that I am not aware of).
>>>  I am trying to set the above directive in my httpd.conf file as 
>>> follows:
>>>  <Directory /home/*/www/cgi-bin/>
>>>         PythonInterpPerDirective On       # or 
>>> PythonInterpPerDirectory On
>>>  </Directory>
>> You can check whether this is even coming into play by including:
>>   deny from all
>> If the path pattern is right, you should then get Forbidden.
>>>  now I test this by creating two directories within a user's cgi-bin 
>>> say /home/user/www/cgi-bin/handler1 and 
>>> /home/user/www/cgi-bin/handler2 and add a handler module and a 
>>> .htaccess file with the following contents:
>>> SetHandler mod_python
>>>  PythonHandler mptest
>>>  PythonDebug On
>>>  Within the handlers, I am creating a cache dictionary at global 
>>> level and testing the cache for that dictionary by printing its 
>>> values and also printing the id of the cache dictionary.  When 
>>> executing both handlers, it appears that both handlers in both 
>>> directories are sharing the subinterpreters when they should not be.
>> I wouldn't necessarily rely on using Python id() as basis to determine
>> if they are same/different interpreter.
>> For starters, simply display value of "req.interpreter". This will be
>> the name given to each interpreter. It should equate somehow to the 
>> path
>> to the physical directory.
>> Note that there are some bugs in the PythonInterpPerDirectory 
>> directive.
>> See:
>>   http://issues.apache.org/jira/browse/MODPYTHON-5
>> This is address in mod_python 3.2 beta versions.
>> Graham

More information about the Mod_python mailing list