Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'scripts': 0.03; 'ideally': 0.04; 'cpython': 0.05; 'subject:Python': 0.06; '(using': 0.07; 'automate': 0.07; 'definitions': 0.07; "subject:' ": 0.07; 'classes.': 0.09; 'functioning': 0.09; 'api': 0.11; 'python': 0.11; 'changes': 0.15; 'api,': 0.16; 'pyqt,': 0.16; 'stuff!': 0.16; 'thoughts?': 0.16; 'subject:python': 0.16; 'app': 0.19; 'appears': 0.22; 'source': 0.25; 'script': 0.25; 'defined': 0.27; 'idea': 0.28; 'complete,': 0.31; 'object.': 0.31; 'thanks!': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'c++': 0.36; 'doing': 0.36; 'message-id:@gmail.com': 0.38; 'hat': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'users': 0.40; 'how': 0.40; 'header:Message-Id:1': 0.63; 'soon': 0.63; 'disappear': 0.84; 'it\xe2\x80\x99s': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:content-transfer-encoding:subject:message-id:date :to:mime-version; bh=2LPfZIoV/Vj92/Z/7rxWdLOWzNpmRzym9rLOeLKNwzM=; b=n2tHshAQn5a68Ye/0wW7nnO0EPO4SnaK/1RTaKI/oDra2Yd30Aoa3EBivfKUyMh0bP yQmqx+yLlI/XkrTUSQlJGLbnrcFDTJrJiNWjFfF8iGKky4XqWlUDa8bPIAEr/l/DwA5q uMqkHI+zA9GogTCn4ydQmVppJWMiQYi0XwegVno68sR2ndkzfkXv8pM9P/PaUepeQo6j ZwmluWteftuVfOMWfkm5Z2F+HzJG+CZbNvv5fF4MPi9jaJu4+XeF5KphGoz/bLGqZ61o SxX4Mjc9sBNNrcMSAN7iQWjrLlSo0gp5a8OpHe221XViIxXVXAGpNxXzed64OdjxOim/ i/Iw== X-Received: by 10.70.54.1 with SMTP id f1mr6826319pdp.63.1416721700659; Sat, 22 Nov 2014 21:48:20 -0800 (PST) From: Patrick Stinson Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Embedded python 'scripting engine' inside Python app Date: Sat, 22 Nov 2014 20:48:18 -0900 To: python-list@python.org Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) X-Mailer: Apple Mail (2.1993) X-Mailman-Approved-At: Sun, 23 Nov 2014 10:04:29 +0100 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416733471 news.xs4all.nl 2851 [2001:888:2000:d::a6]:47615 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81346 I am writing a python app (using PyQt, but that=E2=80=99s not important = here), and want my users to be able to write their own scripts to = automate the app=E2=80=99s 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=E2=80=99s state and respond to callbacks from the api object. It = appears this won=E2=80=99t work with exec() because the script=E2=80=99s = definitions and state disappear as soon as the exec() call is complete, = and the script doesn=E2=80=99t seem to be able to access it=E2=80=99s = own defined functions and classes. Thoughts? Fun stuff! Thanks!=