I am sure there is a way do do what you describe. Here is a common usage (snippet from BentBolt_v3.04.py):
- 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()
-
return
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:
- from macrolib.ExceptWarn import formatExceptionInfo
-
-
errorList = []
-
-
try:
-
# some code to execute
-
except Exception:
-
errorList.append(formatExceptionInfo())
-
-
print "\n".join(errorList)
Most 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.
- try:
-
# some code to execute
-
except:
-
pass