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


Groups > comp.lang.python > #24408

Re: exception problem

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!204.52.135.9.MISMATCH!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'mrab': 0.05; 'debug': 0.07; 'exception.': 0.09; 'python': 0.10; 'cc:addr:python-list': 0.10; '(it': 0.16; 'exist.': 0.16; 'opposite': 0.16; 'silly': 0.16; 'subject:exception': 0.16; 'thread,': 0.16; 'wrote:': 0.17; '>>>': 0.22; 'subject:problem': 0.22; 'header:In-Reply-To:1': 0.23; 'header:User-Agent:1': 0.26; 'cc:2**0': 0.27; 'cc:no real name:2**0': 0.28; "doesn't": 0.28; 'cc:addr:python.org': 0.29; 'displayed': 0.29; 'skip:_ 10': 0.31; 'could': 0.33; 'problem': 0.35; 'except': 0.35; 'but': 0.36; 'point.': 0.37; 'subject:: ': 0.37; 'pm,': 0.38; 'wanted': 0.38; 'anything': 0.39; 'information': 0.62; 'real': 0.63; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'received:74.208': 0.72; 'bare': 0.84
Date Sun, 24 Jun 2012 21:02:29 -0400
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1
MIME-Version 1.0
To Charles Hixson <charleshixsn@earthlink.net>
Subject Re: exception problem
References <4FE79433.8020704@earthlink.net> <4FE7982C.5020708@mrabarnett.plus.com> <4FE79FC9.5050404@earthlink.net>
In-Reply-To <4FE79FC9.5050404@earthlink.net>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:agcF5RPG9gIUYJCjMZvmluLagukheU+1gmKoy6cQQ42 BX0Hzjo1mubOsiyv0HpKIVmX1us9myXUVlDBQAEgnxK8PLoAKY GUBUbB7fsFQoLgwAGALTDtkSWOUkvYZkk9vHED0ZWkldzzLGNc TL/HzGQBiJVyCwgkhCJMOqRnrwdjoCpHu956iYLunx/4SrDV6x 1FX8itLSVAZu9LNejuXLtzZZFr7l7C0UCTq5fmBa32j5t0ie9m SqiL1aJFWnildnW+vJ2XMqIkp+yS1MXLYTa2O7Qlee9sdwFEaB sZVZtw3AJdfl7hWoPf/zG2qIpTVkKB7ITPLqP05gqtZIyu9bQ= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1468.1340586188.4697.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1340586188 news.xs4all.nl 6880 [2001:888:2000:d::a6]:39270
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:24408

Show key headers only | 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