Exception Messages

John Gordon gordon at panix.com
Mon Oct 15 12:22:04 EDT 2012


In <mailman.2217.1350317845.27098.python-list at python.org> MRAB <python at mrabarnett.plus.com> writes:

> > Why wasn't the message printed out?
>
> You didn't add a __str__ method:

> class PvCamError(Exception):
>      def __init__(self, msg):
>          self.msg = msg
>      def __str__(self):
>          return self.msg

Wouldn't PvCamError inherit __str__() from Exception?

-- 
John Gordon                   A is for Amy, who fell down the stairs
gordon at panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list