From 88334acdef5c22aeab04c1d80dcb4373f60f4cca Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 7 Apr 2010 10:29:00 +0200 Subject: [PATCH] [#90 state:fixed] Fixed a rare crash on results loading. --- core/app.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/core/app.py b/core/app.py index 59ea72ae..9296817b 100644 --- a/core/app.py +++ b/core/app.py @@ -90,8 +90,14 @@ class DupeGuru(RegistrableApplication, Broadcaster): j = j.start_subjob([1, 9]) self.results.load_from_xml(op.join(self.appdata, 'last_results.xml'), self._get_file, j) files = flatten(g[:] for g in self.results.groups) - for file in j.iter_with_progress(files, 'Reading metadata %d/%d'): - file._read_all_info(attrnames=self.data.METADATA_TO_READ) + try: + for file in j.iter_with_progress(files, 'Reading metadata %d/%d'): + file._read_all_info(attrnames=self.data.METADATA_TO_READ) + except OSError: + # If this error is raised, it means that a file was deleted while we were reading + # metadata. Proper handling of this rare occurrence is complex because there's no easy + # way to remove an arbitrary file from the Results. Thus, we simply clear them. + self.results.groups = [] def _get_display_info(self, dupe, group, delta=False): if (dupe is None) or (group is None):