python sandbox question

viral shah shahviral.it at gmail.com
Fri May 4 02:47:57 EDT 2012


Hi

Can anyone answer these two questions :

I have two questions regarding Pysandbox:

1.) How do I achieve the functionality of eval? I understand
sandbox.execute() is equivalent to exec, but I can't find anything such
that if the code entered were 2 + 2, then it would return 4, or something
to that effect.

2.) By default, sandbox.execute() makes a passed-in environment read-only
-- i.e. if I do sandbox.execute('data.append(4)', locals={'data': [1, 2,
3]}), an error will occur. How do I make passed-in environments read-write?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120504/53b11246/attachment.html>


More information about the Python-list mailing list