stop script w/o exiting interpreter

Garrick.Peterson at Garrick.Peterson at
Mon Jan 29 17:22:36 CET 2007

> I want, and the script will stop executing at that line and will
> return to the interactive interpreter, as I wish.

May I recommend wrapping your main program in a function definition? Such 

        # Bulk of your code (use a macro to indent it faster)

if __name__ == "__main__":

Then you should be able to throw in a "return" at any point and get a 
clean break, without affecting the flow of your program. This should make 
it easier to debug as well, offering a clean entry point from the python 
interactive session, and letting you return a specific value you wish to 

Garrick M. Peterson
Quality Assurance Analyst
Zoot Enterprises, Inc.
garrick.peterson at

Copyright © 2007 Zoot Enterprises, Inc. and its affiliates.  All rights 
reserved. This email, including any attachments, is confidential and may 
not be redistributed without permission. If you are not an intended 
recipient, you have received this message in error; please notify us 
immediately by replying to this message and deleting it from your 
computer. Thank you. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list