catch read-only error

This commit is contained in:
Damien Elmes 2012-05-18 06:09:59 +09:00
parent 02b83025a7
commit b1d3637557

View file

@ -299,6 +299,9 @@ def onImport(mw):
if "invalidFile" in unicode(e): if "invalidFile" in unicode(e):
showWarning(_("""\ showWarning(_("""\
Invalid file. Please run a DB check in Anki 1.2 and try again.""")) Invalid file. Please run a DB check in Anki 1.2 and try again."""))
elif "readonly" in unicode(e):
showWarning(_("""\
Unable to import from a read-only file."""))
else: else:
msg = _("Import failed.\n") msg = _("Import failed.\n")
msg += unicode(traceback.format_exc(), "ascii", "replace") msg += unicode(traceback.format_exc(), "ascii", "replace")