logging module - restricted mode error

Vinay Sajip vinay_sajip at yahoo.co.uk
Sun Oct 21 16:52:07 CEST 2007

On 21 Oct, 07:50, Paul Rudin <paul.nos... at rudin.co.uk> wrote:
> > Can you say a little bit more about the execution environment? For
> > example, are you running under mod_python? If so, which version?
> I'm not running under mod_python - but this is using cherrypy. I also
> do some passing of pickled objects between two python processes, which
> I guess could be relevant.
> > When googling, did you search for the exact text of the error message?
> > For example, did you see the following post?
> > http://mail-archives.apache.org/mod_mbox/httpd-python-dev/200404.mbox/%3C408661A5.3010...@sjsoft.com%3E
> I hadn't noticed that particularly, but I'm still a little unclear as
> to what's going on. That thread dates from 3 years ago and it seems to
> imply that mod python is using restricted mode (in the sense of the
> the rexec module), which won't run in 2.5 will it?
> One parts that says:
>   "Restricted mode is a strange beast, in that there isn't really
>    anything like a "restricted mode" flag, but it looks at a pointer
>    somwhere (don't remember now), and if it's not what is expected, it
>    concludes that it's in restricted mode. So this behaviour is
>    actually a sign of a bug where an object is created in one
>    subinterpreter but is running in another... These bugs can be hard
>    to track down."
> What exactly is meant by a subinterpreter? Python running in a
> subprocess?

I'm no mod_python expert: I just wondered whether you might be hitting
the same problem. The way I read it, the "restricted mode" referred to
in that post is not in the rexec sense, but based on some more obscure
heuristic to do with multiple interpreters. Anyway: I don't think it's
specifically a logging problem, except that logging does introspect
(look at LogRecord.__dict__) and this raises the error. But in that,
it's no different to lots of other stdlib and third party modules.


More information about the Python-list mailing list