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


Groups > comp.lang.python > #24485 > unrolled thread

Re: exception problem

Started byChris Angelico <rosuav@gmail.com>
First post2012-06-27 07:36 +1000
Last post2012-06-27 07:36 +1000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: exception problem Chris Angelico <rosuav@gmail.com> - 2012-06-27 07:36 +1000

#24485 — Re: exception problem

FromChris Angelico <rosuav@gmail.com>
Date2012-06-27 07:36 +1000
SubjectRe: exception problem
Message-ID<mailman.1530.1340746572.4697.python-list@python.org>
(You posted privately to me again; I hope you don't mind my responding
on-list as this appears to have been merely oversight.)

On Wed, Jun 27, 2012 at 5:25 AM, Charles Hixson
<charleshixsn@earthlink.net> wrote:
> Only thing is, this whole mess started when I was trying to trace down and
> expected error.  (Which turned out to be "self.chunkLine(..." where self
> wasn't defined.)  It was running without ANY error being displayed.  Though
> as I look an outer loop is inclosed in a try:except:finally:  It still has
> an unlabelled except, because I don't remember what exception is thrown when
> a file reads an unintelligible character  (i.e., it isn't really a utf-8
> file).  Currently I've fixed all the files so that they're either utf-8 or
> just ASCII, so currently it isn't getting triggered, but it's still there.
>  So that's probably the explanation.  I think I'll fix that now.  (I can, I
> guess, assume that any exception will be caught by except BasicException:)

That's the problem, your blanket try/except. Don't do it! It blinds
you. Same goes for catching Exception or BaseException. Catch what you
really need to catch, and reserve catch-all statements for special
cases where you don't have access to the console.

ChrisA

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web