Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'skip': 0.04; 'to:addr:comp.lang.python': 0.09; 'from:addr:miki.tebeka': 0.16; 'from:name:miki tebeka': 0.16; 'subject:case': 0.16; 'cc:addr :python-list': 0.16; 'cc:no real name:2**0': 0.21; 'header:In- Reply-To:1': 0.22; 'received:209.85.220': 0.25; 'cc:2**0': 0.26; '(see': 0.28; 'subject:skip:a 10': 0.29; 'cc:addr:python.org': 0.29; 'error': 0.30; 'url:library': 0.31; 'header:User-Agent:1': 0.33; 'flag': 0.34; 'set.': 0.34; 'url:python': 0.35; 'received:google.com': 0.37; 'another': 0.37; 'received:209.85': 0.38; 'url:org': 0.39; 'option': 0.39; 'received:209': 0.39; 'goodbye': 0.73 Newsgroups: comp.lang.python Date: Wed, 15 Feb 2012 10:40:00 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.82.8.111; posting-account=uo-8fwoAAACKsFzFX78JHudx1V7WDXZ0 References: User-Agent: G2/1.0 X-Google-Web-Client: true MIME-Version: 1.0 Subject: Re: atexit.register in case of errors From: Miki Tebeka To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Message-ID: Lines: 3 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1329331202 news.xs4all.nl 6918 [2001:888:2000:d::a6]:34231 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20459 Another option is to use a global error flag and set it in sys.excepthook (see http://docs.python.org/library/sys.html#sys.excepthook). goodbye will check the error flag and skip execution if error flag is set.