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


Groups > comp.lang.python > #24408

Re: exception problem

Date 2012-06-24 21:02 -0400
From Dave Angel <d@davea.name>
Subject Re: exception problem
References <4FE79433.8020704@earthlink.net> <4FE7982C.5020708@mrabarnett.plus.com> <4FE79FC9.5050404@earthlink.net>
Newsgroups comp.lang.python
Message-ID <mailman.1468.1340586188.4697.python-list@python.org> (permalink)

Show all headers | View raw


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

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


Thread

Re: exception problem Dave Angel <d@davea.name> - 2012-06-24 21:02 -0400

csiph-web