diff --git a/gramps/plugins/lib/libmetadata.py b/gramps/plugins/lib/libmetadata.py index 46293aca3..d1166921d 100644 --- a/gramps/plugins/lib/libmetadata.py +++ b/gramps/plugins/lib/libmetadata.py @@ -21,6 +21,13 @@ # # $Id$ # +#------------------------------------------------------------------------- +# +# Python modules +# +#------------------------------------------------------------------------- +import os + #------------------------------------------------------------------------- # # GNOME modules @@ -172,10 +179,13 @@ class MetadataView(Gtk.TreeView): """ self.sections = {} self.model.clear() - - try: - metadata = GExiv2.Metadata(full_path) - except: + + if os.path.exists(full_path): + try: + metadata = GExiv2.Metadata(full_path) + except: + return False + else: return False get_human = metadata.get_tag_interpreted_string @@ -221,9 +231,12 @@ class MetadataView(Gtk.TreeView): """ Return True if the gramplet has data, else return False. """ - try: - metadata = GExiv2.Metadata(full_path) - except: + if os.path.exists(full_path): + try: + metadata = GExiv2.Metadata(full_path) + except: + return False + else: return False for tag in TAGS: