473,287 Members | 1,399 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,287 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 2617
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.