[Dextrose] [PATCH sugar-toolkit] Get rid of IPython

Aleksey Lim alsroot at activitycentral.org
Fri Feb 11 20:51:47 EST 2011


It is bugg on fc11, failed to print traceback due to internal import errors.
---
 src/sugar/feedback.py |   23 +++--------------------
 1 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/src/sugar/feedback.py b/src/sugar/feedback.py
index 770b7a7..5833d61 100644
--- a/src/sugar/feedback.py
+++ b/src/sugar/feedback.py
@@ -28,7 +28,6 @@ _SHELL_IFACE = "org.laptop.Shell"
 
 _report = {}
 _need_log = False
-_log_formatter = None
 
 
 def start(activity_id, log_path=None):
@@ -79,29 +78,13 @@ def _send(activity_id, log_path):
             log_path if need_log else '')
 
 
-def _format_exception(exctype, value, tb):
-    import traceback
-    return ''.join(traceback.format_exception(exctype, value, tb))
-
-
 def _excepthook(exctype, value, tb):
-    global _log_formatter
-
-    if _log_formatter is None:
-        try:
-            # Attempt to provide verbose IPython tracebacks.
-            # Importing IPython is slow, so we import it lazily.
-            from IPython.ultraTB import AutoFormattedTB
-            formatter = AutoFormattedTB(mode='Verbose', color_scheme='NoColor')
-            _log_formatter = formatter.text
-        except BaseException:
-            _log_formatter = _format_exception
-
     try:
-        message = _log_formatter(exctype, value, tb)
+        import traceback
+        message = ''.join(traceback.format_exception(exctype, value, tb))
         logging.error(message)
         trigger('unhandled_exception', need_log=True)
-    except BaseException, error:
+    except Exception, error:
         print >>sys.stderr, 'Unhandled %r while processing: %r %r' % \
                 (error, exctype, value)
 
-- 
1.7.3.4



More information about the Dextrose mailing list