Re: exception problem

Discussion in 'Python' started by Chris Angelico, Jun 26, 2012.

  1. (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
    <> 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-8or
    > 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
     
    Chris Angelico, Jun 26, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jeff
    Replies:
    0
    Views:
    1,548
  2. jeff
    Replies:
    3
    Views:
    1,714
    Scott
    Jun 26, 2003
  3. Kerri
    Replies:
    2
    Views:
    13,088
    Kevin Spencer
    Oct 27, 2003
  4. Ola
    Replies:
    0
    Views:
    552
  5. Selen
    Replies:
    0
    Views:
    2,707
    Selen
    May 28, 2004
Loading...

Share This Page