> Did I misunderstand the problem again?
Hmmm, yes ! But I think I am not expressing clearly my concern :-)
So my problem is that "default exception" are badly designed in their
use of their args attribute.
I know it is possible to subclass Exception as every object and add
the attributes I want
[Sébastien de Menten]
> 2) Could this be changed to .args more in line with:
> a) first example: e.args = ('foo', "NameError: name 'foo' is not
> defined")
> b) second example: e.args = (4, 'foo', "'int' object has no
attribute
> 'foo'",)
> the message of the string can even be retrieved
On 12 Apr 2005 01:57:31 -0700, [EMAIL PROTECTED] (Sebastien de Menten) wrote:
>Thank you guys for those good advices (and the very interesting
>example of AST hacking).
>
>However, this was an example of use for Exception.args. It does not
>alleviate my concerns about the fact that the args attrib
Thank you guys for those good advices (and the very interesting
example of AST hacking).
However, this was an example of use for Exception.args. It does not
alleviate my concerns about the fact that the args attribute is poorly
designed for standard Exceptions.
It is as if the Exception design was
On 11 Apr 2005 03:31:23 -0700, [EMAIL PROTECTED] (Sebastien de Menten) wrote:
>Jeremy Bowers <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>> On Fri, 08 Apr 2005 09:32:37 +, Sébastien de Menten wrote:
>>
>> > Hi,
>> >
>> > When I need to make sense of a python exception,
Sebastien de Menten wrote:
Jeremy Bowers <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
On Fri, 08 Apr 2005 09:32:37 +, SÃÂbastien de Menten wrote:
Hi,
When I need to make sense of a python exception, I often need to parse the
string exception in order to retrieve the data.
Jeremy Bowers <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On Fri, 08 Apr 2005 09:32:37 +, SÃÂbastien de Menten wrote:
>
> > Hi,
> >
> > When I need to make sense of a python exception, I often need to parse the
> > string exception in order to retrieve the data.
>
> W
On Fri, 08 Apr 2005 09:32:37 +, SÃbastien de Menten wrote:
> Hi,
>
> When I need to make sense of a python exception, I often need to parse the
> string exception in order to retrieve the data.
What exactly are you doing with this info? (Every time I started to do
this, I found a better way
Hi,
When I need to make sense of a python exception, I often need to parse the
string exception in order to retrieve the data.
Example:
try:
print foo
except NameError, e:
print e.args
symbol = e.args[0][17:-16]
==> ("NameError: name 'foo' is not defined", )
or
try:
(4).foo
except Nam