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


Groups > comp.lang.python > #81365

Re: Embedded python 'scripting engine' inside Python app

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '"this': 0.03; 'open- source': 0.04; 'anyway.': 0.05; 'subject:Python': 0.06; 'debugging': 0.07; "subject:' ": 0.07; 'executed': 0.09; 'interpreted': 0.09; 'latter': 0.09; 'parsed': 0.09; 'salaried': 0.09; 'cc:addr:python-list': 0.11; '24,': 0.16; 'dump': 0.16; 'examples:': 0.16; 'executor': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'happily': 0.16; 'renamed': 0.16; 'version"': 0.16; 'subject:python': 0.16; 'weird': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'app': 0.19; 'patrick': 0.19; '(in': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'stick': 0.24; 'tend': 0.24; 'fairly': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'supported': 0.26; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'external': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'that.': 0.31; 'too.': 0.31; 'easy,': 0.31; 'end,': 0.31; 'so-called': 0.31; 'lists': 0.32; 'there.': 0.32; 'this.': 0.32; 'figure': 0.32; 'languages': 0.32; 'text': 0.33; 'guess': 0.33; 'trouble': 0.34; 'core': 0.34; "can't": 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'tech': 0.36; 'doing': 0.36; 'throughout': 0.37; 'convention': 0.38; 'nov': 0.38; 'window': 0.38; 'anything': 0.39; "couldn't": 0.39; 'enough': 0.39; 'major': 0.40; 'skip:u 10': 0.60; 'expression': 0.60; 'most': 0.60; 'free': 0.61; 'break': 0.61; 'simple': 0.61; "you're": 0.61; 'hear': 0.63; 'kind': 0.63; 'between': 0.67; 'natural': 0.68; 'live,': 0.68; 'secure': 0.71; 'day': 0.76; 'glad': 0.83; 'all;': 0.84; 'distinguish': 0.84; 'i\xe2\x80\x99ll': 0.84; 'underneath': 0.84; 'aka': 0.91; 'obvious,': 0.91; 'to:none': 0.92; 'examine': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=xGWi7jZiHzg13sFmjJzm7o0QFlDL9WUPH8IlTkJ/y6g=; b=FSxkVlwVvEKJXYsUkzWhPhlU0yLEjDt/01GFDvHarSxQeesCNUxX3qkloOJ4ZiiJSE r8uBAxrL9uU9LEGvGkbKziuy8ElUntioEYiz2Or9aSfY87YjPRvpI/DEM4zSWfkC23v4 bcGPLAvb2oNm0W4UngwlPSd0y80KJ+QF2JQWTiFhuYGrEvPI5PEUF+zRnB4tFn3Xmln1 iSEjzLe5wLhCSEEaTPOxAxYF+cZkkSWMn52mlfiEr5B/Y+GylIhzdjuFVvuULygjOhdl tJ5JfA8/jI0b+fV3ZVmkyKrMkrFAWUWvRMvkqBb6/3HKf6Ihlrvkg962q13KYK/mj7C4 tkaA==
MIME-Version 1.0
X-Received by 10.107.17.79 with SMTP id z76mr13399098ioi.27.1416751064024; Sun, 23 Nov 2014 05:57:44 -0800 (PST)
In-Reply-To <CCBF6B5F-8F53-4B57-9F61-41FA33EC8E67@gmail.com>
References <05D7659F-9D0B-466B-833E-8454DCF0F57A@gmail.com> <CAPTjJmqCgvgUCahVnnTj0+jJgvUrugk2501q7Pci2ZB3q-1J+Q@mail.gmail.com> <0B2C4A0D-401C-446E-9EE6-C04791F904DB@gmail.com> <CAPTjJmrQqqVNLXf8PP+sCT6USbvshciQBonK=L+SdM-4TwHmYQ@mail.gmail.com> <CCBF6B5F-8F53-4B57-9F61-41FA33EC8E67@gmail.com>
Date Mon, 24 Nov 2014 00:57:43 +1100
Subject Re: Embedded python 'scripting engine' inside Python app
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16183.1416751073.18130.python-list@python.org> (permalink)
Lines 49
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416751073 news.xs4all.nl 2848 [2001:888:2000:d::a6]:36144
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:81365

Show key headers only | View raw


On Mon, Nov 24, 2014 at 12:20 AM, Patrick Stinson <patrickkidd@gmail.com> wrote:
> I think this is the way I’ll take it, and for all the same reasons. The only way they can break it is if they really want to. I guess anything other Franken-apps would be interesting to hear about too. And I’ll still stick it on the app store.
>

(Please note, the convention on this list/newsgroup - as with most
tech lists - is to put your text underneath what you're quoting -
so-called "bottom-posting" or "interleaved" style.)

Yep. I got in some trouble for doing this at my last salaried
employment, because the boss couldn't get his head around the idea
that an XKCD 936-compliant password is secure enough for a code
executor, and that the absence of a code executor makes debugging much
harder. (In the end, I just renamed it to "calculator" so it wasn't so
obvious, and left it there. Debugging is important.) In my open-source
MUD client, Gypsum, there's a code executor built-in, which I use
regularly as a simple calculator, and also to manipulate the program's
internals. Some examples:

> /x 123+456*789
359907
> /x asin(.5)*180/3.14159
30.0000253399374
> /x "Test "*5 + "Haha"
"Test Test Test Test Test Haha"
> /x window.mainwindow.iconify()
GTK2.Window
(and the main window has just been minimized, aka iconified)

Basically, any expression that I type after "/x" will be parsed and
executed as code. There's no sandboxing at all; it's executed in its
own globals() and locals(), but if it wants to tinker with external
state, it's free to do that. Since all the code is there for the user
to peruse anyway, I don't distinguish between "this you may do" and
"this you may not do", but instead between "this is pledged to be
supported throughout this major version" and "this is undocumented,
use at your own risk" - on the understanding that most of the latter
category is actually pretty stable, and can happily be used anyway.

Interpreted languages tend to make this kind of thing fairly easy, and
on the day you have a weird error that you can't figure out, you will
be no end of glad you have this. No triggering a core dump and then
doing a post-mortem, just examine state live, using the language's
natural syntax.

ChrisA

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


Thread

Re: Embedded python 'scripting engine' inside Python app Chris Angelico <rosuav@gmail.com> - 2014-11-24 00:57 +1100

csiph-web