sys.exit and exceptions (newbie question)

Fredrik Lundh fredrik at effbot.org
Fri Feb 2 09:10:25 CET 2001


Thomas Wouters wrote:
> You can use sys._exit(). This exits in a very abortive way -- right away,
> dropping everything it's doing, without doing any kind of cleanup.

only if you're not catching AttributeError, that is ;-)

>>> import sys
>>> sys._exit()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: _exit

(it's "os._exit(code)", not "sys._exit()")

Cheers /F





More information about the Python-list mailing list