Newbie Question: Aborting a Python script

Wojtek Walczak gminick at hacker.pl
Sat Nov 30 12:11:17 EST 2002


Dnia Sat, 30 Nov 2002 03:44:51 -0600, Tom Nunamaker napisał(a):
> How do you stop a script during execution?  Do I have to throw an error 
> like a divide by zero?  I didn't see any abort, stop, halt, etc type of 
> function.

>>> import sys,os
>>> print sys.exit.__doc__
exit([status])

Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
>>> print os._exit.__doc__
_exit(status)
Exit to the system with specified status, without normal exit processing.

HTH.
-- 
[ ] gminick (at) underground.org.pl  http://gminick.linuxsecurity.pl/ [ ]
[ "Po prostu lubie poranna samotnosc, bo wtedy kawa smakuje najlepiej." ]



More information about the Python-list mailing list