Pychecker warns about Exception example from Python tutorial

Josiah Carlson jcarlson at uci.edu
Fri Oct 15 18:11:55 EDT 2004


You can fix your pychecker error by adding the non-quoted line below...


> ------------- code starts -------
> class MyError(Exception):
>      def __init__(self, value):
           Exception.__init__(self)
>          self.value = value
>      def __str__(self):
>          return repr(self.value)
> 
> try:
>      raise MyError(2*2)
> except MyError, e:
>      print 'My exception occurred, value:', e.value




More information about the Python-list mailing list