Re: confusion around CustomException example in 'Python in a Nutshell'

2005-03-13 Thread Peter Hansen
[EMAIL PROTECTED] wrote: What I am trying to do is get information from a raised custom exception. I am catching the exception in a main() function but it was actually raised in a separate module function. It would be nice if I could print out where the exception was raised from (module.functio

Re: confusion around CustomException example in 'Python in a Nutshell'

2005-03-12 Thread erick_bodine
Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > > In Martinelli's Nutshell book in the Exceptions chapter there is an > > example of a custom exception class (pg.112) that I am trying to > > implement without success. The custom exception class example pulls > > sys.exc_info() into an attribute

Re: confusion around CustomException example in 'Python in a Nutshell'

2005-03-11 Thread Peter Hansen
[EMAIL PROTECTED] wrote: In Martinelli's Nutshell book in the Exceptions chapter there is an example of a custom exception class (pg.112) that I am trying to implement without success. The custom exception class example pulls sys.exc_info() into an attribute and I am assuming that the attribute wo

Re: confusion around CustomException example in 'Python in a Nutshell'

2005-03-11 Thread [EMAIL PROTECTED]
I don't know the mentioned book, but if you rewrite like: >>> import sys >>> class LinuxDriverError(Exception): ... def __init__(self, *args): ... Exception.__init__(self, *args) ... self.message = args[0] ... ... def __str__(self): ... return str(sys.exc_info()) ...

confusion around CustomException example in 'Python in a Nutshell'

2005-03-11 Thread erick_bodine
In Martinelli's Nutshell book in the Exceptions chapter there is an example of a custom exception class (pg.112) that I am trying to implement without success. The custom exception class example pulls sys.exc_info() into an attribute and I am assuming that the attribute would then contain the rais