From db954c1e21705ffb5179cdb495086c08a4ea981b 2008-08-08 06:51:02 From: Gael Varoquaux Date: 2008-08-08 06:51:02 Subject: [PATCH] Fix for Unicode characters when executing processes. Also fix typo in sync_traceback hook. --- diff --git a/IPython/frontend/wx/console_widget.py b/IPython/frontend/wx/console_widget.py index 0bf21b6..da91206 100644 --- a/IPython/frontend/wx/console_widget.py +++ b/IPython/frontend/wx/console_widget.py @@ -212,12 +212,20 @@ class ConsoleWidget(editwindow.EditWindow): segment = segments.pop(0) self.GotoPos(self.GetLength()) self.StartStyling(self.GetLength(), 0xFF) - self.AppendText(segment) + try: + self.AppendText(segment) + except UnicodeDecodeError: + # XXX: Do I really want to skip the exception? + pass if segments: for ansi_tag, text in zip(segments[::2], segments[1::2]): self.StartStyling(self.GetLength(), 0xFF) - self.AppendText(text) + try: + self.AppendText(text) + except UnicodeDecodeError: + # XXX: Do I really want to skip the exception? + pass if ansi_tag not in self.ANSI_STYLES: style = 0 diff --git a/IPython/frontend/wx/wx_frontend.py b/IPython/frontend/wx/wx_frontend.py index dc8056b..1ba94f1 100644 --- a/IPython/frontend/wx/wx_frontend.py +++ b/IPython/frontend/wx/wx_frontend.py @@ -276,6 +276,7 @@ class WxController(PrefilterFrontEnd, ConsoleWidget): """ Capture the character events, let the parent widget handle them, and put our logic afterward. """ + # FIXME: This method needs to be broken down in smaller ones. current_line_number = self.GetCurrentLine() if event.KeyCode in (ord('c'), ord('C')) and event.ControlDown(): # Capture Control-C diff --git a/IPython/kernel/core/sync_traceback_trap.py b/IPython/kernel/core/sync_traceback_trap.py index 4c0c5b7..439d2b8 100644 --- a/IPython/kernel/core/sync_traceback_trap.py +++ b/IPython/kernel/core/sync_traceback_trap.py @@ -34,7 +34,7 @@ class SyncTracebackTrap(TracebackTrap): """ self.args = args - print self.sync_formatters(*self.args) + print self.sync_formatter(*self.args)