Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40361

Re: Dealing with exceptions

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder1.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bob@mellowood.ca>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'exception': 0.03; 'that?': 0.05; 'filename': 0.07; 'abort': 0.09; 'propagate': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'anyway': 0.11; 'ignore': 0.13; '"real"': 0.16; 'exception?': 0.16; 'module': 0.19; 'bit': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'disk': 0.27; 'errors.': 0.27; 'correct': 0.28; 'trouble': 0.28; 'probably': 0.29; 'maybe': 0.29; 'that.': 0.30; '(and': 0.32; 'received:google.com': 0.34; 'so,': 0.35; 'doing': 0.35; 'continue': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; "didn't": 0.36; 'subject:with': 0.36; 'should': 0.36; 'bad': 0.37; 'received:209': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'save': 0.61; 'first': 0.61; 'between': 0.63; 'cut': 0.71; 'yourself': 0.77; 'console,': 0.84; 'distinguish': 0.84; 'them)': 0.84; 'thing,': 0.84
X-Received by 10.49.120.105 with SMTP id lb9mr158420qeb.17.1362253174790; Sat, 02 Mar 2013 11:39:34 -0800 (PST)
Newsgroups comp.lang.python
Date Sat, 2 Mar 2013 11:39:34 -0800 (PST)
In-Reply-To <mailman.2789.1362248472.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=207.102.131.95; posting-account=ABEwJgoAAAC1F6nSxfugvLwMw0aH_wrF
References <707df78f-9a67-4ce1-8dd3-095c75a7f7da@googlegroups.com> <mailman.2789.1362248472.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 207.102.131.95
MIME-Version 1.0
Subject Re: Dealing with exceptions
From bvdp <bob@mellowood.ca>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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>
Message-ID <mailman.2793.1362253693.2939.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1362253693 news.xs4all.nl 6908 [2001:888:2000:d::a6]:33330
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:40361

Show key headers only | View raw


> 
> Here's a bit of a left-field thought: Maybe none of them.
> 

Not far left at all :)
> 
> What are you actually doing when you get an exception? Can you
> 
> plausibly recover? If not - that is, if you're going to abort the
> 
> whole operation anyway - then save yourself the trouble of writing the
> 
> try/catch, and just let the exception propagate up (to the console, if
> 
> nowhere else).
> 

My first cut of the program did exactly that. Just abort the whole thing, figuring that the disk was full or buggered.

What I ran into was that half way through the process I ended up with a filename which the FAT32 didn't like. So, my brain-dead idea was to catch those (and ignore them) and continue on. But then I have to distinguish between a bad filename and "real" errors.

But, you are probably correct if you say I should check the filename first :) Is there a module for that?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 09:40 -0800
  Re: Dealing with exceptions Kwpolska <kwpolska@gmail.com> - 2013-03-02 18:52 +0100
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
      Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 01:41 +0000
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:35 -0800
    Re: Dealing with exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-03 00:41 +0000
      Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 12:04 +1100
    Re: Dealing with exceptions Nobody <nobody@nowhere.com> - 2013-03-03 23:01 +0000
  Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 10:58 -0700
  Re: Dealing with exceptions Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-02 11:00 -0700
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 05:21 +1100
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
    Re: Dealing with exceptions bvdp <bob@mellowood.ca> - 2013-03-02 11:39 -0800
  Re: Dealing with exceptions Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-03-02 19:18 +0000
  Re: Dealing with exceptions Devin Jeanpierre <jeanpierreda@gmail.com> - 2013-03-02 14:27 -0500
  Re: Dealing with exceptions Rick Johnson <rantingrickjohnson@gmail.com> - 2013-03-02 11:43 -0800
  Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 16:23 -0500
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 09:16 +1100
  Re: Dealing with exceptions Terry Reedy <tjreedy@udel.edu> - 2013-03-02 18:08 -0500
  Re: Dealing with exceptions Chris Angelico <rosuav@gmail.com> - 2013-03-03 10:17 +1100

csiph-web