Non-secure execution environment
Ken Seehart
ken at seehart.com
Fri Apr 17 03:16:10 EDT 2009
rogeeff at gmail.com wrote:
> Hi,
>
> I am C++ guy for the most part and don't know much of Python, so,
> please, bear with me if I am asking errrm..idiotic question.
>
> Old rexec module provided kinda 'secure' execution environment. I am
> not looking for security at this point. What I need an execution
> environment which almost like rexec, but is non-secure.
> What I want is:
> separate global dictionary,
> separate list of imported modules,
> separate sys.path
> (optionaly) separate __builtins__
>
> I might be able to get away without my own builtins, but the rest I
> need.
>
> If it's any help, I plan to use it to execute embedded Python scripts
> from C++.
>
> Thanks,
>
> Gennadiy
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
As far as I know, you can't make multiple instances of the python
environment from within python, but there is an easier way to get what
you want, given that this is an embedding situation.
See: http://wingware.com/psupport/python-manual/1.5/api/initialization.html
You can use Py_NewInterpreter() to create multiple instances of python,
which should give you the desired effect (though I have not tried this).
- Ken
More information about the Python-list
mailing list