From 43264e5908f18ad393da2fa7fd975057b364fa23 Mon Sep 17 00:00:00 2001 From: David Cantrell Date: Fri, 24 Oct 2008 12:31:13 -1000 Subject: Catch UnicodeDecodeError so traceback messages display anyway. I've seen this happen in recent nightly builds. UnicodeDecodeError gets thrown by unicode() and the traceback window doesn't finish rendering and we get two tracebacks dumped to the console, one for the traceback window tracebacking and the original one we were going to display. This workaround at least gets us traceback windows displaying. I don't know enough about unicode() to do anything more with it right now, so this seems reasonable. If the exception is thrown, I log a message so we have some record of the unicode failure. My guess is that the i18n files are invalid and/or incompatible with what we're trying to shove them through in Python. But that's just a guess. --- gui.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gui.py') diff --git a/gui.py b/gui.py index 0f271f26b..98aaa4562 100755 --- a/gui.py +++ b/gui.py @@ -1056,7 +1056,11 @@ class DetailedMessageWindow(MessageWindow): for line in longText: if __builtins__.get("type")(line) != unicode: - line = unicode(line, encoding='utf-8') + try: + line = unicode(line, encoding='utf-8') + except UnicodeDecodeError, e: + log.error("UnicodeDecodeException: line = %s" % (line,)) + log.error("UnicodeDecodeException: %s" % (str(e),)) textbuf.insert(iter, line) -- cgit