can't specify coding in unicode(except); convert traceback instead

This commit is contained in:
Damien Elmes 2012-05-23 09:19:07 +09:00
parent 4c398fc728
commit 2f6db69113
2 changed files with 4 additions and 2 deletions

View file

@ -201,7 +201,7 @@ class AddonDownloader(QThread):
resp, cont = con.request(
aqt.appShared + "download/%d" % self.code)
except Exception, e:
self.error = unicode(e, "utf8", "replace")
self.error = unicode(e)
return
finally:
remHook("httpRecv", recvEvent)

View file

@ -122,7 +122,7 @@ Please upgrade to the latest version of Anki.""")
elif "502" in err or "503" in err or "504" in err:
return _("""\
AnkiWeb is too busy at the moment. Please try again in a few minutes.""")
return unicode(err, "utf8", "replace")
return err
def _getUserPass(self):
d = QDialog(self.mw)
@ -234,6 +234,8 @@ class SyncThread(QThread):
self._sync()
except:
err = traceback.format_exc()
if not isinstance(err, unicode):
err = unicode(err, "utf8", "replace")
self.fireEvent("error", err)
finally:
# don't bump mod time unless we explicitly save