Executing a script created by the end user

Craig Howard craig.howard at earthlink.net
Sun Jan 16 14:46:38 EST 2005


I am working on a python project where an object will have a script that 
can be edited by the end user: object.script

If the script is a simple one with no functions, I can easily execute it 
using:
	exec object.script

But if the object script is a bit more complicated, such as the example 
below, my approach does not  work:

def main():
	hello1()
	hello2()

def hello1():
	print 'hello1'

def hello2():
	print 'hello2'



More information about the Python-list mailing list