Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11959
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.shlink.de!news1.wobline.de!news.bcc.de!newsfeeder.ewetel.de!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'sorts': 0.04; 'over,': 0.05; 'attribute': 0.07; 'exception,': 0.07; 'raised': 0.07; 'received:verizon.net': 0.07; 'terry': 0.07; 'python': 0.08; 'correct.': 0.09; 'exception.': 0.09; 'exceptions': 0.09; 'fix.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subclass': 0.09; 'throw': 0.09; 'subject:error': 0.10; 'exception': 0.12; '"exception': 0.16; 'errno': 0.16; 'reedy': 0.16; 'socket.error': 0.16; 'surprising': 0.16; 'towns': 0.16; 'unhandled': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'jan': 0.19; "doesn't": 0.22; 'header :In-Reply-To:1': 0.22; '(or': 0.23; 'pm,': 0.24; 'libraries': 0.24; 'expect': 0.25; 'writes:': 0.25; "i'm": 0.27; 'host': 0.27; 'paul': 0.28; 'remote': 0.28; 'raise': 0.28; 'bugs': 0.28; 'mode': 0.28; 'operations': 0.30; 'bare': 0.30; 'down,': 0.30; 'fails,': 0.30; '(e.g.': 0.31; 'list': 0.32; 'there': 0.33; 'to:addr:python- list': 0.33; 'that,': 0.33; 'someone': 0.34; 'header:User- Agent:1': 0.34; 'approach.': 0.34; 'header:X-Complaints-To:1': 0.35; 'certain': 0.35; 'unless': 0.36; 'anything': 0.36; 'connection': 0.36; 'instead.': 0.37; 'but': 0.37; 'something': 0.37; 'received:org': 0.38; 'steven': 0.38; 'some': 0.38; 'should': 0.38; 'went': 0.38; 'subject:: ': 0.39; 'etc.)': 0.39; 'represent': 0.39; 'header:Mime-Version:1': 0.39; 'either': 0.39; 'subject:with': 0.39; "there's": 0.39; "couldn't": 0.39; 'recommended': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'case': 0.39; "it's": 0.40; 'minimum': 0.40; 'power': 0.63; 'customer': 0.65; 'ever': 0.65; 'cause': 0.67; 'site.': 0.68; 'dealing': 0.69; 'business': 0.70; 'kinds': 0.70; 'heavy': 0.71; 'failure': 0.73; 'retail': 0.77; 'cycling': 0.84; 'everything.': 0.84; 'irrelevant.': 0.84; 'mention.': 0.84; 'remedy': 0.84; 'subject:... ': 0.84; 'subject:types': 0.84; 'absolutely': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Reedy <tjreedy@udel.edu> |
| Subject | Re: try... except with unknown error types |
| Date | Sun, 21 Aug 2011 15:52:28 -0400 |
| References | <mailman.230.1313780957.27778.python-list@python.org> <j2mcne$rmo$1@reader1.panix.com> <4e4ec405$0$29994$c3e8da3$5496439d@news.astraweb.com> <7xipprsxha.fsf@ruckus.brouhaha.com> <4e5015ad$0$29986$c3e8da3$5496439d@news.astraweb.com> <7xty9ahb84.fsf@ruckus.brouhaha.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-74-109-121-73.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 |
| In-Reply-To | <7xty9ahb84.fsf@ruckus.brouhaha.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.286.1313956388.27778.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1313956388 news.xs4all.nl 23913 [2001:888:2000:d::a6]:55091 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:11959 |
Show key headers only | View raw
On 8/21/2011 2:26 PM, Paul Rubin wrote: > Steven D'Aprano<steve+comp.lang.python@pearwood.info> writes: >>> But there's no way to know what that minimum is. Python libraries throw >>> all sorts of exceptions that their documentation doesn't mention. >> >> Yes, you're absolutely correct. But it's also irrelevant. Most of those >> exceptions should not be caught, even if you know what they are, because >> they represent either bugs that should be fixed, or bad data which should >> raise an exception. A bare except, or except Exception, is hardly ever the >> right approach. > > I'm not sure what to do instead. The exceptions I'm currently dealing > with happen when certain network operations go wrong (e.g. network or > remote host is down, connection fails, etc.) The remedy in each case is > to catch the exception, log the error, and try the operation again > later. But there's no guaranteed-to-be-complete list in the Python docs > of all the exceptions that can be thrown. A new and surprising mode of > network failure can lead to an unhandled exception, unless you catch > everything. I would expect that catching socket.error (or even IOError) should catch all of those. "exception socket.error A subclass of IOError, this exception is raised for socket-related errors. It is recommended that you inspect its errno attribute to discriminate between different kinds of errors." > It's a retail application that would cause some business disruption and > a pissed off customer if the program went down. Also it's in an > embedded box on a customer site. It's not in Antarctica or anything > like that, but it's a few towns over, and someone would have to drive > there (probably through heavy traffic) if something went wrong that > power cycling the box couldn't fix. -- Terry Jan Reedy
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
try... except with unknown error types Yingjie Lin <Yingjie.Lin@mssm.edu> - 2011-08-19 15:09 -0400
Re: try... except with unknown error types John Gordon <gordon@panix.com> - 2011-08-19 19:14 +0000
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 06:13 +1000
Re: try... except with unknown error types John Gordon <gordon@panix.com> - 2011-08-19 20:24 +0000
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-20 06:45 +1000
Re: try... except with unknown error types Seebs <usenet-nospam@seebs.net> - 2011-08-20 05:46 +0000
Re: try... except with unknown error types John Nagle <nagle@animats.com> - 2011-08-20 13:15 -0700
Re: try... except with unknown error types Paul Rubin <no.email@nospam.invalid> - 2011-08-20 12:18 -0700
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-21 06:14 +1000
Re: try... except with unknown error types Paul Rubin <no.email@nospam.invalid> - 2011-08-21 11:26 -0700
Re: try... except with unknown error types Chris Angelico <rosuav@gmail.com> - 2011-08-21 20:17 +0100
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-22 10:30 +1000
Re: try... except with unknown error types Chris Angelico <rosuav@gmail.com> - 2011-08-22 01:41 +0100
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-22 14:01 +1000
Re: try... except with unknown error types Paul Rubin <no.email@nospam.invalid> - 2011-08-23 00:21 -0700
Re: try... except with unknown error types Chris Angelico <rosuav@gmail.com> - 2011-08-23 09:26 +0100
Re: try... except with unknown error types gene heskett <gheskett@wdtv.com> - 2011-08-23 04:43 -0400
Re: try... except with unknown error types Paul Rubin <no.email@nospam.invalid> - 2011-08-23 10:43 -0700
Re: try... except with unknown error types Chris Angelico <rosuav@gmail.com> - 2011-08-23 10:07 +0100
Re: try... except with unknown error types John Nagle <nagle@animats.com> - 2011-08-31 21:22 -0700
Re: try... except with unknown error types Ethan Furman <ethan@stoneleaf.us> - 2011-08-21 12:22 -0700
Re: try... except with unknown error types Terry Reedy <tjreedy@udel.edu> - 2011-08-21 15:52 -0400
Re: try... except with unknown error types Chris Torek <nospam@torek.net> - 2011-08-31 21:01 +0000
Re: try... except with unknown error types Stefan Krah <stefan-usenet@bytereef.org> - 2011-09-09 23:41 +0200
Re: try... except with unknown error types Nobody <nobody@nowhere.com> - 2011-09-10 10:33 +0100
Re: try... except with unknown error types Peter Otten <__peter__@web.de> - 2011-09-10 12:17 +0200
Re: try... except with unknown error types Roy Smith <roy@panix.com> - 2011-08-21 17:14 -0400
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-22 10:25 +1000
Re: try... except with unknown error types Roy Smith <roy@panix.com> - 2011-08-21 22:09 -0400
Re: try... except with unknown error types Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-08-23 18:33 +1000
csiph-web