[code.view]

[top] / python / PyMOTW / sys / sys_excepthook.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2009 Doug Hellmann All rights reserved.
     #
     """
     """
     #end_pymotw_header
     
     import sys
     
     def my_excepthook(type, value, traceback):
         print 'Unhandled error:', type, value
     
     sys.excepthook = my_excepthook
     
     print 'Before exception'
     
     raise RuntimeError('This is the error message')
     
     print 'After exception'
     

[top] / python / PyMOTW / sys / sys_excepthook.py

contact | logmethods.com