Follow this pattern:
try: print 'A' sys.exit() print 'B'except SystemExit: sys.stdout.flush()In this example, 'A" is printed, but 'B' is not
Follow this pattern:
try: print 'A' raise RuntimeError('Please open a window')except RuntimeError as err: DialogDisplayer().showMessageDialog(str(err))except SystemExit: sys.stdout.flush()You can define your own exceptions or reuse built-in exceptions.
See Creating your own classes library
See How to write safe Python scripts
Is it possible to use C-Python libraries such as Enthought with INTViewer's Python engine ?
JPython and C-based Python libraries are not natively compatible. However, it is possible to bridge Jython and C-Python.