diff options
author | David Cantrell <dcantrell@redhat.com> | 2008-10-24 12:31:13 -1000 |
---|---|---|
committer | David Cantrell <dcantrell@redhat.com> | 2008-10-24 12:31:13 -1000 |
commit | 43264e5908f18ad393da2fa7fd975057b364fa23 (patch) | |
tree | 53ace60c24edfd33f1117b39f6222c5d512723f3 | |
parent | f92daebe85291cba6bb447903831136b9339dcde (diff) | |
download | anaconda-43264e5908f18ad393da2fa7fd975057b364fa23.tar.gz anaconda-43264e5908f18ad393da2fa7fd975057b364fa23.tar.xz anaconda-43264e5908f18ad393da2fa7fd975057b364fa23.zip |
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.
-rwxr-xr-x | gui.py | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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) |