How do you get Exceptions to print messages? I have an exception defined like 
this

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

But when the error is raised I get this:

Traceback (most recent call last):
  File 
"C:\Python27\lib\site-packages\ipython-0.12.1-py2.7.egg\IPython\core\interactiveshell.py",
 line 2538, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
  File "<ipython-input-1-fb48da797583>", line 1, in <module>
    import S477Test
  File "U:\workspace\camera\src\S477Test.py", line 13, in <module>
    camera.getSerialNum()
  File "U:\workspace\camera\src\S477.py", line 131, in getSerialNum
    num = self.pl.getParamValue(pvcamConstants.PARAM_HEAD_SER_NUM_ALPHA)
  File "U:\workspace\camera\src\pvcam.py", line 261, in getParamValue
    raise PvCamError("Unhandled Type: {0}".format(attype))
PvCamError

Why wasn't the message printed out?
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to