Looking for a way to include Pyhtho scripting INSIDE a python program
Bryan Oakley
oakley at bardo.clearlight.com
Sun Apr 13 12:20:16 EDT 2008
Ivan Illarionov wrote:
> You don't need to envoke another interpreter.
> Python can interpret arbitrary python code with exec statement.
> Wrap user's string inside function definition, and exec it.
>
> You might want to disable words like `import`, `exec` and `eval` in
> user's code because it's a big security risk.
The above statement is exactly why one would want to eval the code
inside a separate interpreter. Not just for security, but to prevent
user code from stomping all over the application code by creating or
destroying global resources.
Is it possible to create a nested interpreter like you can do in some
other languages?
More information about the Python-list
mailing list