[mod_python] strange runtime exception

Sam Brauer sam at webslingerZ.com
Mon Apr 8 11:31:31 EST 2002


I have recently observed an intermittent exception that I think may be 
related to mod_python.  It may also be a Python problem, but I have only 
ever seen it occur under mod_python, so I thought I'd ask here first.

What happens is that I call code like this inside a handler:
utf8string = unicode(val, enc).encode('utf-8')
(where val is a string in an encoding identified by enc)

Most of the time (in fact, for days or even weeks) this works fine.  Then 
every so often I will get the following exception:

exceptions.RuntimeError: cannot unmarshal code objects in restricted 
execution mode
File "/usr/local/lib/python2.2/encodings/__init__.py", line 51, in 
search_function
mod = __import__(modname,globals(),locals(),'*')

Once I encounter this exception, I can hit the same url again and may or
may not get the exception again.  There seems to be no pattern to its
occurrence. But generally, once it occurs it will recur "at random" until
apache is restarted.

Has anyone else seen this before, or have any idea why it's happening?

Many thanks,
Sam

-- 
Sam Brauer
Systems Programmer
sam at webslingerZ.com




More information about the Mod_python mailing list