Python script engine

Dave Kuhlman dkuhlman at rexx.com
Thu Oct 18 13:09:00 EDT 2001


The built-in function exec will do this for you (or use eval, if
it's a expression).

But exec is dangerous, because it enables your users to do anything
that Python can do.  If this is too much power, then look at
'rexec' (Restricted execution framework) in the Python standard
library.

And, if _you_ want to implement the commands that your users
execute, then take a look at 'cmd' (Support for line-oriented
command interpreters) in the Python standard library.

Also, if you want users to enter and execute Python code
interactively, then I believe you will want to look at 'code'
(Interpreter base classes) in the Python standard library.  You
will find an example of it's use in Tools/idle in the Python source
code distribution.

  - Dave

A <printers at sendme.cz> wrote:
> 
> Hello,
> In my application I  would like to allow users to add/use basic  
> python  commands but I do not want users to change my code of 
> application directly.
> 
> 
> For example my program expects 
> telephone. number in  format 
> +442076812563
> but a user sometimes may want to 
> supply
> 0044  207 681 2563
> (please note a blank).
> Then the user would need
> to use  STRING.JOIN  Python function  to get from the user's input 
> (0044  207 681 2563) the string that my program expects 
> (+442076812563)
> 
> Does anyone have any idea how to do that? 
> 
> Thank you for help
> Ladislav
> 
> 

-- 
Dave Kuhlman
dkuhlman at rexx.com


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list