473,387 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

logging module - restricted mode error


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.htmlbut 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?

Oct 16 '07 #1
3 2620
On 16 Oct, 04:14, Paul Rudin <paul.nos...@rudin.co.ukwrote:
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.htmlbut 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?

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_...@sjsoft.com%3E

Vinay Sajip

Oct 20 '07 #2
Vinay Sajip <vi*********@yahoo.co.ukwrites:
On 16 Oct, 04:14, Paul Rudin <paul.nos...@rudin.co.ukwrote:
>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.htmlbut 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_...@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?
Oct 21 '07 #3
On 21 Oct, 07:50, Paul Rudin <paul.nos...@rudin.co.ukwrote:
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_...@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.

Vinay

Oct 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: j vickroy | last post by:
Hello, I'm trying to understand the behavior of the Python 2.3 logging module (MS Windows 2k) with regard to RotatingFileHandler. The following script illustrates a puzzling problem. What is...
6
by: Ville Vainio | last post by:
Just posting this for the sake of google: Like everyone else, I figured it's time to start using the 'logging' module. I typically want to dump "info" level (and up) log information to...
2
by: rh0dium | last post by:
Hi all, So I have a slice of code which calls other python code. I have started to take a real liking to the logging module, but I want to extend this into the called python code. I have no...
23
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field...
3
by: sj | last post by:
Suppose the following are part of a long file and executed: logging.basicConfig(stream = sys.stderr, level=logging.INFO) logging.info("%d %d", 1, 2, 3) # buggy ...
0
by: robert | last post by:
As more and more python packages are starting to use the bloomy (Java-ish) 'logging' module in a mood of responsibility and as I am not overly happy with the current "thickener" style of usage, I...
7
by: flupke | last post by:
Hi, i'm getting errors with the log module concerning RotatingFileHandler. I'm using Python 2.4.3 on Windows XP SP2. This used to work in previous python versions but since i upgraded to 2.4.3...
3
by: seb | last post by:
Hi, I am writing to a file some basic information using the logging module. It is working but in the log file some line are printed several time. I had put some print debugging messages in the...
3
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.