problem with change to exceptions

Alex Popescu nospam.themindstorm at gmail.com
Fri Jul 27 19:24:14 EDT 2007


Neal Becker <ndbecker2 at gmail.com> wrote in news:f8dspe$fm2$1 at sea.gmane.org:

> import exceptions
> 
> class nothing (exceptions.Exception):
>     def __init__ (self, args=None):
>         self.args = args
> 
> if __name__ == "__main__":
>     raise nothing
> 
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/usr/tmp/python-3143hDH", line 5, in __init__
>     self.args = args
> TypeError: 'NoneType' object is not iterable
> 
> I'll have to say, I don't understand this error.
> 

You can pass to the exception:
a) a string (it will become the message)
b) a tuple of values (can it be a list also?)

In your case there is no message, no values so args is NoneType.

bests,
./alex
--
.w( the_mindstorm )p.




More information about the Python-list mailing list