diff --git a/aqt/main.py b/aqt/main.py index 608cec7ee..5fe6bf3f5 100644 --- a/aqt/main.py +++ b/aqt/main.py @@ -264,15 +264,19 @@ To import into a password protected profile, please open the profile before atte def loadCollection(self): self.hideSchemaMsg = True + cpath = self.pm.collectionPath() try: - self.col = Collection(self.pm.collectionPath(), log=True) + self.col = Collection(cpath, log=True) except anki.db.Error: - # move back to profile manager + # warn user showWarning("""\ Your collection is corrupt. Please see the manual for \ how to restore from a backup.""") - self.unloadProfile() - raise + # move it out of the way so the profile can be used again + newpath = cpath+str(intTime()) + os.rename(cpath, newpath) + # then close + sys.exit(1) except Exception, e: # the custom exception handler won't catch this if we immediately # unload, so we have to manually handle it