Finn Bock wrote:
>>My program works fine in jython, but I can't use jythonc to create an
>>I narrowed the problem down to this line of python code:
>> import random
>>The stack trace given when I try to run the applet is as follows (it's
>>longer than that, but I'm trying to keep the message short).
>> at org.python.core.__builtin__.eval(__builtin__.java)
>> at random$_PyInner._verify$1(random.java:377)
>>So, it appears that the _verify method in the random module is doing an
>Indeed. Rather thoughless bit of code there. I suggest you edit your
>copy of random.py to have an empty _verify() function:
>def _verify(name, expected):
>I have posted a patch to CPython and will include a version of random.py
>in 2.1b1 that does not use eval().
Thanks. That worked (but, you knew it would...). I was not certain
that I could safely change that function in my own module, so I
appreciate the help.
>>So, I tried not importing random at all, but rather doing a simple eval:
>>print eval("1 + 1")
>>Again, I am required to use --all (which kind of makes sense), and
>>again, I get an AccessControlException just like above.
>>Does this mean that I can't use eval or any module that uses eval in my
>Correct, you can't use eval() or compile() in a restricted environment
>such as applets.
I'll make the logical leap that says I can't do an 'exec' on uncompiled
code, as well.
I was looking at that, and noticed that Jython is building java code
from the dynamic code in the eval, which makes sense from a performance
standpoint, but obviously breaks the applet security manager when it
tries to compile and dynamically load it.
Is there any talk of allowing an option that would bundle the jython
interpreter when compiling with jythonc, so that eval's, exec's, and
compile's can be used in applets? I believe that embedding the
interpreter would allow for that, though I can't be certain without
digging into the source a bit more.
Anyway, it's a thought. I'll be following the list more closely now and
really spending some time in the Jython source. Jython is an incredibly
cool project, and I am interested in contributing where I can.
Thanks again for your help.