I used ExceptWarn.py to catch exceptions/errors in my sds/2 custom member, now the system makes the user hit OK every time the error message pop out... Is there any way I could put those messages in a warning message list allowing processing to finish without having to hit OK?
How to bypass ExceptWarn.py exceptions/errors
Collapse
X
-
-
I am sure there is a way do do what you describe. Here is a common usage (snippet from BentBolt_v3.04. py):
Upon an error, the error information is displayed in a warning widget, cleanup is performed, and the script terminates. You could do something like this instead:Code:from macrolib.ExceptWarn import formatExceptionInfo ## Set self.boltType dlg1 = setTypeDialog(self) try: dlg1.get().done() except ResponseNotOK: self.cleanUP() return except Exception, e: Warning(formatExceptionInfo()) self.cleanUP() returnMost of the time you would not want the code to proceed when an error occurs. If an inconsequential error does occur, a simple pass may be more appropriate.Code:from macrolib.ExceptWarn import formatExceptionInfo errorList = [] try: # some code to execute except Exception: errorList.append(formatExceptionInfo()) print "\n".join(errorList)Code:try: # some code to execute except: pass -
Comment