python - I get "TypeError: exceptions must derive from BaseException" even though I did define it -


according python documents, exception derived baseexceptions , should use user defined exceptions. have:

class visaioerror(exception):      def __init__(self, error_code):         abbreviation, description = _completion_and_error_messages[error_code]         error.__init__(self, abbreviation + ": " + description)         self.error_code = error_code 

and

 raise(visa_exceptions.visaioerror, status) 

but (trackback snippet):

   file "c:\python32\lib\site-packages\pyvisa\vpp43.py", line 400, in check_status      raise(visa_exceptions.visaioerror, status)     typeerror: exceptions must derive baseexception 

note: converting code python 27 32

i have :

raise visa_exceptions.visaioerror(status) 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -