Embedded python 'scripting engine' inside Python app

Stefan Behnel stefan_ml at behnel.de
Sun Nov 23 13:49:37 CET 2014


Chris Angelico schrieb am 23.11.2014 um 11:35:
> On Sun, Nov 23, 2014 at 9:28 PM, Patrick Stinson wrote:
>> Is there a better and more secure way to do the python-within-python in
>> order allow users to automate your app?
> 
> More secure? Basically no. You could push the inner script into a
> separate process, but I would recommend simply acknowledging the
> insecurity. Embrace the lack of security and call it a debugging
> feature - make it possible to introspect, control, manipulate internal
> structures. Feature, not flaw. :)

As the author of Lupa, I know that some people have successfully and safely
embedded Lua in Python as a simple, small and object-oriented scripting
language in a sandbox.

https://pypi.python.org/pypi/lupa

The overall syntax isn't quite as great as that of Python, but as long as
you mostly stick to "here's a bunch of functions you can call" or "here's
an object, go and call some methods on it" kind of APIs, there isn't all
that much of a difference either.

Stefan





More information about the Python-list mailing list