On 2012-10-15 17:22, John Gordon wrote:
In <mailman.2217.1350317845.27098.python-l...@python.org> MRAB 
<pyt...@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?

Yes, but you've put the message in msg, and Exception doesn't have that
attribute.

An alternative approach would be:

class PvCamError(Exception):
    pass

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to