From 311d9b16b9387d6b7d3eb46552bfa62d76a5a3b4 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Wed, 16 Sep 2009 20:31:28 +0000 Subject: [PATCH] Silently accept "not found" errors when deleting database files svn: r13215 --- src/gen/db/write.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/gen/db/write.py b/src/gen/db/write.py index 05419ac53..4731f6c62 100644 --- a/src/gen/db/write.py +++ b/src/gen/db/write.py @@ -655,7 +655,10 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback): for (database, name) in items: database.close() _db = db.DB(self.env) - _db.remove(_mkname(self.full_name, name), name) + try: + _db.remove(_mkname(self.full_name, name), name) + except db.DBNoSuchFileError: + pass if callback: callback(index) index += 1 @@ -887,7 +890,10 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback): for index, (dbmap, dbname) in enumerate(db_maps): getattr(self, dbmap).close() _db = db.DB(self.env) - _db.remove(_mkname(self.full_name, dbname), dbname) + try: + _db.remove(_mkname(self.full_name, dbname), dbname) + except db.DBNoSuchFileError: + pass callback(index+1) # Open reference_map and primary map @@ -1574,11 +1580,17 @@ class GrampsDBDir(GrampsDbRead, Callback, UpdateCallback): # Disconnect unneeded secondary indices self.surnames.close() _db = db.DB(self.env) - _db.remove(_mkname(self.full_name, SURNAMES), SURNAMES) + try: + _db.remove(_mkname(self.full_name, SURNAMES), SURNAMES) + except db.DBNoSuchFileError: + pass self.reference_map_referenced_map.close() _db = db.DB(self.env) - _db.remove(_mkname(self.full_name, REF_REF), REF_REF) + try: + _db.remove(_mkname(self.full_name, REF_REF), REF_REF) + except db.DBNoSuchFileError: + pass return transaction @catch_db_error