From f58ee6472aca040e9e72331339d47f89bc8f4c31 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 22 Jul 2010 11:54:21 -0600 Subject: [PATCH] Fix unicode bug in error handling --- src/calibre/gui2/device.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index cdbe31de65..cadb4f1e46 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -72,7 +72,14 @@ class DeviceJob(BaseJob): # {{{ if self._aborted: return self.failed = True - self._details = unicode(err) + '\n\n' + \ + try: + ex = unicode(err) + except: + try: + ex = str(err).decode(preferred_encoding, 'replace') + except: + ex = repr(err) + self._details = ex + '\n\n' + \ traceback.format_exc() self.exception = err finally: