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


Groups > comp.lang.python > #40361

Re: Dealing with exceptions

Newsgroups comp.lang.python
Date 2013-03-02 11:39 -0800
References <707df78f-9a67-4ce1-8dd3-095c75a7f7da@googlegroups.com> <mailman.2789.1362248472.2939.python-list@python.org>
Subject Re: Dealing with exceptions
From bvdp <bob@mellowood.ca>
Message-ID <mailman.2793.1362253693.2939.python-list@python.org> (permalink)

Show all headers | 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