Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #95154
| Path | csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'finally:': 0.05; 'except:': 0.07; 'cc:addr:python-list': 0.09; 'timeout': 0.09; 'exception': 0.13; 'explicitly': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:exception': 0.16; 'try/except': 0.16; 'wrote:': 0.16; 'try:': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'aug': 0.20; 'trying': 0.22; 'am,': 0.23; 'sat,': 0.23; 'this:': 0.23; 'tried': 0.24; 'header:In-Reply-To:1': 0.24; "doesn't": 0.26; 'message- id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'there.': 0.30; "i'm": 0.30; 'print': 0.30; "can't": 0.32; 'changing': 0.34; 'except': 0.34; 'received:google.com': 0.35; "isn't": 0.35; 'subject:: ': 0.37; 'why': 0.39; 'still': 0.40; 'connection,': 0.72; 'chrisa': 0.84; 'to:none': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=HqOpUltSv+zgT1RnX2Xahue0d6gheaYyq8VfytpnOtM=; b=TOal4SnfvY9flBoAfLG+05C1ba49X8jh/8gXbnVeKM+kFt4HPMptop7xD38PA7PbPF nJxJkpgdF8pCMRqIPIoRFHmjo9GpcCB5muzKg8jMk+R25FzlwIttF9Q70LwPuZfdemAk ooudSkB9eEipLj4wCPMeuISzk+UFe4rAA2NJRsyzyKuXkTsy/W57AYQvkezD3H8ky7A8 fDfeCyfuaMi4ruSuOVTMjJh+N2MsMkRaNlHaS94cMzZXXknJpqeABygriOUAvHw/DTAQ hiEjvB6SvryqE8HQZeKg/fLOq85ytmEfF8jJAojBW8uzvkp9Yhu13VmlBGcVZKOepeib yTNw== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.31.134 with SMTP id f128mr10808740iof.19.1439001871485; Fri, 07 Aug 2015 19:44:31 -0700 (PDT) |
| In-Reply-To | <c0684935-c807-4d98-9a04-8c2f7986169d@googlegroups.com> |
| References | <48587161-1bd6-47e4-b2c9-7a37c60a59e5@googlegroups.com> <mailman.1286.1438908366.3674.python-list@python.org> <c0684935-c807-4d98-9a04-8c2f7986169d@googlegroups.com> |
| Date | Sat, 8 Aug 2015 12:44:31 +1000 |
| Subject | Re: except block isn't catching exception |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1325.1439001880.3674.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1439001880 news.xs4all.nl 2903 [2001:888:2000:d::a6]:42301 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:95154 |
Show key headers only | View raw
On Sat, Aug 8, 2015 at 3:16 AM, <sohcahtoa82@gmail.com> wrote: > > Though I still doesn't understand why the exception isn't caught when I'm explicitly trying to catch it. I even tried changing the try/except block to this: > > try: > connection, _ = sock.accept() > except KeyboardInterrupt: > print 'KeyboardInterrupt caught!' > except socket.timeout: > print 'Socket timeout caught!' > except: > print 'other exception caught!' > finally: > print 'finally!' > > The result prints: > > Interrupting main > main interrupted! > finally! The exception isn't happening inside sock.accept(), as I explained. So you can't catch it there. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
except block isn't catching exception sohcahtoa82@gmail.com - 2015-08-06 17:34 -0700
Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-07 10:46 +1000
Re: except block isn't catching exception sohcahtoa82@gmail.com - 2015-08-07 10:16 -0700
Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-08 12:44 +1000
Re: except block isn't catching exception Ian Kelly <ian.g.kelly@gmail.com> - 2015-08-08 00:56 -0600
Re: except block isn't catching exception Chris Angelico <rosuav@gmail.com> - 2015-08-08 17:08 +1000
csiph-web