From e0112c89b22b08fb77c6396eccb04ff9f4b459c6 2012-02-01 20:52:15 From: MinRK <benjaminrk@gmail.com> Date: 2012-02-01 20:52:15 Subject: [PATCH] token passed to format_lines must be unicode, not str otherwise a TypeError is raised in str.translate, since unicode.translate takes a dict, while str.translate takes a bytestring --- diff --git a/IPython/frontend/qt/console/pygments_highlighter.py b/IPython/frontend/qt/console/pygments_highlighter.py index a80bcec..ef964d0 100644 --- a/IPython/frontend/qt/console/pygments_highlighter.py +++ b/IPython/frontend/qt/console/pygments_highlighter.py @@ -174,7 +174,7 @@ class PygmentsHighlighter(QtGui.QSyntaxHighlighter): def _get_format_from_document(self, token, document): """ Returns a QTextCharFormat for token by """ - code, html = self._formatter._format_lines([(token, 'dummy')]).next() + code, html = self._formatter._format_lines([(token, u'dummy')]).next() self._document.setHtml(html) return QtGui.QTextCursor(self._document).charFormat()