logging module - restricted mode error

Paul Rudin paul.nospam at rudin.co.uk
Sun Oct 21 08:50:34 CEST 2007


Vinay Sajip <vinay_sajip at yahoo.co.uk> writes:

> On 16 Oct, 04:14, Paul Rudin <paul.nos... at rudin.co.uk> wrote:
>> I'm occasionally seeing tracebacks like this:
>>
>> Traceback (most recent call last):
>>   File "logging/__init__.py", line 744, in emit
>>   File "logging/__init__.py", line 630, in format
>>   File "logging/__init__.py", line 421, in format
>> RuntimeError: instance.__dict__ not accessible in restricted mode
>>
>> I'm not sure what it means. Googling leads me to
>> <http://docs.python.org/lib/restricted.html> but that says that those
>> modules were disabled in 2.3 and I'm running 2.5.1. In any case I'm
>> not using them (although it could be that one of the 3rd party modules
>> I'm using does something.)
>>
>> Could someone please explain what this error means?
>
> 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.3010001@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?



More information about the Python-list mailing list