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


Groups > comp.lang.python > #24485

Re: exception problem

References (4 earlier) <4FE7F6CC.2050704@earthlink.net> <4FE803F8.3050207@gmail.com> <4FE8803C.3020108@earthlink.net> <CAPTjJmpZwO21MPSHFUo0CC-kY=z+h+BMNvkNtzy5LQPP87HyHA@mail.gmail.com> <4FEA0CC5.9050203@earthlink.net>
Date 2012-06-27 07:36 +1000
Subject Re: exception problem
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1530.1340746572.4697.python-list@python.org> (permalink)

Show all headers | View raw


(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

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


Thread

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

csiph-web