Providing Python scripting to a Python application

Gonçalo Rodrigues op73418 at mail.telepac.pt
Fri Dec 27 07:57:18 EST 2002


On Fri, 27 Dec 2002 12:52:35 +0000, Gonçalo Rodrigues
<op73418 at mail.telepac.pt> wrote:

>On Fri, 27 Dec 2002 11:46:47 GMT, "Satheesh Babu"
><vattekkat.babu at verizon.net> wrote:
>
>>Hello,
>>
>>I'm writing a Python app at the moment. I've several Python functions in a
>>library that I look into by introspection to let users create a "script" -
>>nothing more than a series of function calls with GUI to edit parameter
>>values and order of calling.
>>
>>At the moment, I store this "script" in a Python class and then execute it
>>by eval()-uating functions. What I would love to do is to add normal
>>Python constructs like if-else, for, while etc.
>>
>>Anyone have any pointers to things on the web that I can look into for
>>making a applications in which macros can be written using Python?
>>
>>Background: This is primarily a Windows app, though it should be portable
>>'coz it uses wxPython. At the moment, target audience is people who find
>>using MS-Word difficult - hence the GUI circus to add functions and edit
>>parameters. Atleast for Windows, I'll need to package it using py2exe so
>>that it installs like a "normal  Windows app" :-)
>>
>>What it does is to expose a library to users through GUI so that they can
>>create scripts that run on batches of files, without help from programmers
>>all the time.
>>
>>Thanks in advance
>>
>>S Babu
>>http://vsbabu.org/
>
>Check out the exec statement. Basically it goes as:
>
>exec <code> in <globals>
>
>where <code> is a string (Python code) or a code object, and <globals>
>is a dictionary that will serve as the global namespace in which the cod
>will be run.

Now, here's a funny typo. Just a couple of lost cod's swimming in a
namespace, la la la

>
>All the best,
>G. Rodrigues

All the best,
G. Rodrigues



More information about the Python-list mailing list