[cig-commits] r4100 - cs/pythia/trunk/pyre/applications
leif at geodynamics.org
leif at geodynamics.org
Mon Jul 24 16:24:42 PDT 2006
Author: leif
Date: 2006-07-24 16:24:42 -0700 (Mon, 24 Jul 2006)
New Revision: 4100
Modified:
cs/pythia/trunk/pyre/applications/Script.py
Log:
Fire-up pdb and IPython when an exception occurs
(if IPython is available).
Modified: cs/pythia/trunk/pyre/applications/Script.py
===================================================================
--- cs/pythia/trunk/pyre/applications/Script.py 2006-07-24 23:12:49 UTC (rev 4099)
+++ cs/pythia/trunk/pyre/applications/Script.py 2006-07-24 23:24:42 UTC (rev 4100)
@@ -25,6 +25,26 @@
return
+ def run(self, *args, **kwds):
+
+ # Fire-up pdb and IPython when an exception occurs -- if IPython is available.
+ try:
+ import sys, IPython.ultraTB
+ if sys.stderr.isatty():
+ colorScheme = 'Linux'
+ else:
+ colorScheme = 'NoColor'
+ if sys.stdin.isatty() and sys.stdout.isatty() and sys.stderr.isatty():
+ callPdb = 1
+ else:
+ callPdb = 0
+ sys.excepthook = IPython.ultraTB.FormattedTB(mode='Verbose', color_scheme=colorScheme, call_pdb=callPdb)
+ except ImportError:
+ pass
+
+ return super(Script, self).run(*args, **kwds)
+
+
# version
__id__ = "$Id: Script.py,v 1.3 2005/03/10 06:06:37 aivazis Exp $"
More information about the cig-commits
mailing list