mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
tweak importing
This commit is contained in:
parent
04f32a7484
commit
24ea85cbae
1 changed files with 6 additions and 4 deletions
|
@ -148,8 +148,9 @@ you can enter it here. Use \\t to represent tab."""),
|
|||
self.importer.run()
|
||||
except Exception, e:
|
||||
msg = _("Import failed.\n")
|
||||
if "1-character string" in unicode(e):
|
||||
msg += unicode(e)
|
||||
err = unicode(e)
|
||||
if "1-character string" in err:
|
||||
msg += err
|
||||
else:
|
||||
msg += unicode(traceback.format_exc(), "ascii", "replace")
|
||||
showText(msg)
|
||||
|
@ -160,7 +161,7 @@ you can enter it here. Use \\t to represent tab."""),
|
|||
_("Importing complete. %(num)d notes imported or updated.\n") %
|
||||
{"num": self.importer.total})
|
||||
if self.importer.log:
|
||||
txt += _("Log of import:\n") + "\n".join(self.importer.log)
|
||||
txt += "\n".join(self.importer.log)
|
||||
self.close()
|
||||
showText(txt)
|
||||
self.mw.reset()
|
||||
|
@ -276,7 +277,8 @@ def onImport(mw):
|
|||
showWarning(_("Selected file was not in UTF-8 format."))
|
||||
return
|
||||
except Exception, e:
|
||||
if e.message == "unknownFormat":
|
||||
msg = unicode(e)
|
||||
if msg == "unknownFormat":
|
||||
showWarning(_("Unknown file format."))
|
||||
else:
|
||||
msg = _("Import failed. Debugging info:\n")
|
||||
|
|
Loading…
Reference in a new issue