How to make execfile exit?
Campbell
cb921 at voice.co.za
Sat Apr 28 15:38:44 EDT 2001
I've got a cute server now, for an incoming connection it identifies the
destination, and runs execfile on the correct python script. My problem
is that once the file is being run, I can find no way to exit from the
execfile function unless the sys.exit() statement is executed in the
root of the script. An example might excuse my explanation:
<---> main script:
import _funky,sys
def funkyclass:
def doit(self):
res = _funky.doit()
if(res == -1):
sys.exit("die execfile die")
me = funkyclass()
execfile('destination.py')
print "execfile finished"
<---> destination.py:
me.doit()
print "prints nothing"
<--->
When calling me.doit from within the execfile I would like failures to
continue after the execfile in the mainscript immediately.
Anybody have any ideas?
thanks again..
campbell
More information about the Python-list
mailing list