Resticted mode still active (error?)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Max

    #1

    Resticted mode still active (error?)

    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=12477 93&forum_id=376 782) - I've given a JEP
    specific example here.

    There seems to be a similar problem with mod_python
    (see

    January/017129.html)

    Reading through the release notes for Python 2.3.5
    I see:
    Bug #754449: threading.Threa d 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\Li b\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


  • Jeff Epler

    #2
    Re: Resticted mode still active (error?)

    Is there a script that causes this problem, without using mod_python or
    jepp? If so, please attach it to the sourceforge bug.
    http://sourceforge.net/tracker/index...70&atid=105470

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.1 (GNU/Linux)

    iD8DBQFCU/pUJd01MZaTXX0RA rl6AKCGNJWxJvkx 73tUSuvKWpg3JLO nKACfUfAD
    Vj0KccGz7AFXZDG 33DNKyZA=
    =MtXP
    -----END PGP SIGNATURE-----

    Comment

    Working...