Resticted mode still active (error?)

Discussion in 'Python' started by Max, Apr 6, 2005.

  1. Max

    Max Guest

    I thought restricted mode had been removed from Python
    but it seems to be active for Python 2.3.5 +.

    I'm using the JEP product which allows integration
    of Java with Python (see http://jepp.sourceforge.net) via
    starting a Python interpreter in the same process as the
    JVM.
    This integrates with python via the C interface, allowing
    the user to 'eval' python code (amongst other features).

    It seems that since Python 2.3.5 any threads (using the
    threading module) created via code that has been
    evaluated through the jep.eval() interface (i.e.Python C
    interface )are executed in restricted mode and cannot,
    for example, create files. Code that is just evaled (i.e not
    in a subthread) thread has no restrictions.

    The error reported is:
    IOError: file() constructor not accessible in restricted
    mode

    (see http://sourceforge.net/forum/forum.php?
    thread_id=1247793&forum_id=376782) - I've given a JEP
    specific example here.

    There seems to be a similar problem with mod_python
    (see
    http://www.modpython.org/pipermail/mod_python/2005-
    January/017129.html)

    Reading through the release notes for Python 2.3.5
    I see:
    Bug #754449: threading.Thread will no longer mask
    exceptions raised during interpreter shutdown with
    another exception caused by attempting to output the
    initial exception. This fix also includes a backport of rev.
    1.41 from HEAD.

    This might be the problem as it seems to involve the
    porting of 2.4 threading code back to the 2.3 tree.

    The error output is:
    Exception in thread Thread-1:
    Traceback (most recent call last):
    File "C:\Python24\Lib\threading.py", line 442, in
    __bootstrap
    File "<string>", line 5, in run
    IOError: file() constructor not accessible in restricted
    mode

    2.4.1c1 (#63, Mar 10 2005, 10:36:41) [MSC v.1310 32
    bit (Intel)]
    Creating file from main thread...
    Done
    Creating file from sub thread...
    Done

    Has anyone got any ideas about this?

    Thanks in advance,
    Max
     
    Max, Apr 6, 2005
    #1
    1. Advertising

  2. Max

    Jeff Epler Guest

    Jeff Epler, Apr 6, 2005
    #2
    1. Advertising

  3. Max

    Max Guest

    Not that I know of - the problem only seems to occur when using the Python C
    API.
    I'm trying to come up with a C programs that shows the error but it'll take
    a few days to set up
    the emvironment.


    >"Jeff Epler" <> wrote in message

    news:...
     
    Max, Apr 7, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John J Lee
    Replies:
    3
    Views:
    519
    bruno at modulix
    Dec 1, 2005
  2. Edward Loper
    Replies:
    0
    Views:
    504
    Edward Loper
    Aug 7, 2007
  3. John J Lee
    Replies:
    0
    Views:
    541
    John J Lee
    Aug 7, 2007
  4. Edward Loper

    mmm-mode, python-mode and doctest-mode?

    Edward Loper, Aug 9, 2007, in forum: Python
    Replies:
    0
    Views:
    454
    Edward Loper
    Aug 9, 2007
  5. Neal Becker
    Replies:
    0
    Views:
    399
    Neal Becker
    Aug 9, 2007
Loading...

Share This Page