home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / gtk-2.0 / bugbuddy.pyc (.txt) next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.4 KB  |  49 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. _saved_except_hook = None
  6. _appname = sys.argv[0]
  7.  
  8. def _bug_catcher(exctype, value, tb):
  9.     import traceback
  10.     import tempfile
  11.     import os
  12.     if exctype is not KeyboardInterrupt:
  13.         msg = ''.join(traceback.format_exception(exctype, value, tb))
  14.         print >>sys.stderr, msg
  15.         (fd, name) = tempfile.mkstemp()
  16.         
  17.         try:
  18.             os.write(fd, msg)
  19.             os.system('bug-buddy --include="%s" --appname="%s"' % (name, _appname))
  20.         finally:
  21.             os.unlink(name)
  22.  
  23.     
  24.     raise SystemExit
  25.  
  26.  
  27. def install(appname = None):
  28.     global _appname, _saved_except_hook
  29.     if appname is None:
  30.         appname = sys.argv[0]
  31.     
  32.     _appname = appname
  33.     if sys.excepthook is not _bug_catcher:
  34.         _saved_except_hook = sys.excepthook
  35.         sys.excepthook = _bug_catcher
  36.     
  37.  
  38.  
  39. def uninstall():
  40.     global _saved_except_hook
  41.     if sys.excepthook is _bug_catcher:
  42.         sys.excepthook = _saved_except_hook
  43.         _saved_except_hook = None
  44.     
  45.  
  46. if not sys.stderr.isatty():
  47.     install()
  48.  
  49.