exception problem

Dave Angel d at davea.name
Sun Jun 24 21:02:29 EDT 2012


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




More information about the Python-list mailing list