"Breaking" the __main__ script

Steve Holden steve at holdenweb.com
Sun Mar 14 09:07:21 EDT 2010


Mark Lawrence wrote:
> vsoler wrote:
>> Hello,
>>
>> I am still learning python, thus developnig small scripts.
>>
>> Some of them consist only of the main module. While testing them
>> (debugging) 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?
>>
>> Vicente Soler
> 
> Something like
> import sys
> sys.exit()?
> 
> HTH.

I think it's less than likely that it will help, since once sys.exit()
is called the program is no longer available for inspection.

The OP is probably looking for the "pdb" module in the standard library.
The documentation is good enough to get you started.

regards
 Steve
-- 
Steve Holden           +1 571 484 6266   +1 800 494 3119
See PyCon Talks from Atlanta 2010  http://pycon.blip.tv/
Holden Web LLC                 http://www.holdenweb.com/
UPCOMING EVENTS:        http://holdenweb.eventbrite.com/




More information about the Python-list mailing list