def __call__(self, etype, evalue, etb):
<EOL>sys.excepthook = sys.__excepthook__<EOL>color_scheme = '<STR_LIT>'<EOL>try:<EOL><INDENT>rptdir = self.app.ipython_dir<EOL><DEDENT>except:<EOL><INDENT>rptdir = os.getcwdu()<EOL><DEDENT>if rptdir is None or not os.path.isdir(rptdir):<EOL><INDENT>rptdir = os.getcwdu()<EOL><DEDENT>report_name = os.path.join(rptdir,self.crash_report_fname)<EOL>self.crash_report_fname = report_name<EOL>self.info['<STR_LIT>'] = report_name<EOL>TBhandler = ultratb.VerboseTB(<EOL>color_scheme=color_scheme,<EOL>long_header=<NUM_LIT:1>,<EOL>call_pdb=self.call_pdb,<EOL>)<EOL>if self.call_pdb:<EOL><INDENT>TBhandler(etype,evalue,etb)<EOL>return<EOL><DEDENT>else:<EOL><INDENT>traceback = TBhandler.text(etype,evalue,etb,context=<NUM_LIT>)<EOL><DEDENT>if self.show_crash_traceback:<EOL><INDENT>print >> sys.stderr, traceback<EOL><DEDENT>try:<EOL><INDENT>report = open(report_name,'<STR_LIT:w>')<EOL><DEDENT>except:<EOL><INDENT>print >> sys.stderr, '<STR_LIT>'<EOL>return<EOL><DEDENT>print >> sys.stderr, '<STR_LIT:\n>'+'<STR_LIT:*>'*<NUM_LIT>+'<STR_LIT:\n>'<EOL>print >> sys.stderr, self.message_template.format(**self.info)<EOL>report.write(self.make_report(traceback))<EOL>report.close()<EOL>raw_input("<STR_LIT>")<EOL>
Handle an exception, call for compatible with sys.excepthook