Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81346

Embedded python 'scripting engine' inside Python app

From Patrick Stinson <patrickkidd@gmail.com>
Subject Embedded python 'scripting engine' inside Python app
Date 2014-11-22 20:48 -0900
Newsgroups comp.lang.python
Message-ID <mailman.16172.1416733471.18130.python-list@python.org> (permalink)

Show all headers | View raw


I am writing a python app (using PyQt, but that’s not important here), and want my users to be able to write their own scripts to automate the app’s functioning using an engine API hat I expose. I have extensive experience doing this in a C++ app with the CPython api, but have no idea how to do this outside of calling exec() from with in Python :)

Ideally their script would compile when the source changes and retain it’s state and respond to callbacks from the api object. It appears this won’t work with exec() because the script’s definitions and state disappear as soon as the exec() call is complete, and the script doesn’t seem to be able to access it’s own defined functions and classes.

Thoughts? Fun stuff!

Thanks!

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Embedded python 'scripting engine' inside Python app Patrick Stinson <patrickkidd@gmail.com> - 2014-11-22 20:48 -0900

csiph-web