[mod_python] mod_python interpreter creation issue

John Belmonte john at neggie.net
Tue Mar 15 22:25:20 EST 2005

Several months ago an installation of my application which uses 
mod_python/Quixote/ZODB/ZEO suddenly stopped working.  It appears to 
have been caused by a mod_python upgrade.  I'm on Debian and now using 
3.1.3, although I don't know what version I was using previously.

I traced the error to a "ImportError: No module named copy_reg" 
resulting from a cPickle.Pickler() call.  This is caused by Python 
thinking that it's in restricted execution mode.  The error is happening 
within ZEO's client thread code.

The following mod_python list message "Threads running in restricted 
mode?" seems to detail similar problems, but no one responded to the issue.


Tim Peters speculates that mod_python might be starting a new 
interpreter from time to time using the Python C API.  The new 
interpreter will have distinct copies of the sys module, the sys.modules 
dict, and the sys.path list, triggering Python's restricted execution mode.

Anyone have some insight to this problem?  Or at least, would someone 
explain how and when mod_python creates new interpreters?

--John Belmonte

More information about the Mod_python mailing list