A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/098980.html below:

How to make execfile exit?

How to make execfile exit? 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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4