"Breaking" the __main__ script

Michael Rudolf spamfresser at ch3ka.de
Sun Mar 14 08:20:03 EDT 2010


Am 14.03.2010 12:53, schrieb Mark Lawrence:
> vsoler wrote:
>> I sometimes want to stop the script at a certain point,
>> with something like stop, break, end or something similar.
>> What statement can I use?
> Something like
> import sys
> sys.exit()?

Or just "raise SystemExit", "raise SyntaxError" or any other Exception.
But you won't have to: If you use IDLE, you can just set breakpoints in 
your code: enable the debugger in debug-debugger and set breakpoints via 
right click in your source file.

Or you could use a real debugger, like pdb
http://docs.python.org/library/pdb.html

HTH,
Michael



More information about the Python-list mailing list