Re: exception problem

Discussion in 'Python' started by Dave Angel, Jun 25, 2012.

  1. Dave Angel

    Dave Angel Guest

    On 06/24/2012 07:16 PM, Charles Hixson wrote:
    > On 06/24/2012 03:43 PM, MRAB wrote:
    >> On 24/06/2012 23:26, Charles Hixson wrote:
    >>> <SNIP>
    >>>
    >>>

    >> Don't use a bare "except"; it'll catch _any__exception. Catch only what
    >> you expect.
    >>
    >> For all I know, it could be that the name "l" doesn't exist.

    > But what I wanted was to catch any exception. A problem was happening
    > and I had no clue as to what it was. (It turned out to be "self is
    > not defined". A silly mistake, but a real one.)
    >


    If you don't get anything else out of this thread, get this point. A
    bare except is exactly the opposite of what you want to debug an
    exception. It swallows all the information that python would have
    displayed for you.

    Four or five of us have made the same point, so please listen.

    --

    DaveA
     
    Dave Angel, Jun 25, 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,542
  2. jeff
    Replies:
    3
    Views:
    1,704
    Scott
    Jun 26, 2003
  3. Kerri
    Replies:
    2
    Views:
    13,064
    Kevin Spencer
    Oct 27, 2003
  4. Ola
    Replies:
    0
    Views:
    544
  5. Selen
    Replies:
    0
    Views:
    2,698
    Selen
    May 28, 2004
Loading...

Share This Page