[Tutor] Early exiting problem. Code must be run in distinct batches

Roger Mallett pythontutorlist@cajaninc.com
Thu, 30 May 2002 18:41:50 -0400


I have a def that when run with a series of other defs *always* exit early.

For example:

    if __name__ == '__main__':
        test()
        brokenDef()   #terminates early

I the example above, brokenDef() terminates early.

So, then I comment out brokenDef() and run test() alone, followed by commenting out test() and running brokenDef() alone, and all is well, I get what I want I just have two distinct runs:

That is:
    if __name__ == '__main__':
        test()
        #brokenDef()

followed by:
    if __name__ == '__main__':
        #test()
        brokenDef()


I've also tried sandwiching as follows to no avail:
    if __name__ == '__main__':
        test1()
        brokenDef()
        test2()

in this case, test1() runs fine, brokenDef() terminates early, and test2() runs fine.


I don't understand what types of things might get in the way.  I've checked available memory and I am only using 134meg of the 256 available.

Has anyone seen similar behavior and if so what might I look for?

Roger Mallett