From c4802bd210dce66ed16a744c531fdecdf2ce39f9 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sun, 20 Jan 2013 19:35:28 +0000 Subject: [PATCH] Fix undefined variable reference, make separate not-loaded warning Thanks to Pat Lefebre for reporting the error. svn: r21179 --- gramps/gen/recentfiles.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gramps/gen/recentfiles.py b/gramps/gen/recentfiles.py index 8903914c4..4be2a8754 100644 --- a/gramps/gen/recentfiles.py +++ b/gramps/gen/recentfiles.py @@ -219,6 +219,7 @@ class RecentParser(object): self.recent_files = [] #Python3's expat wants bytes, Python2's wants a string. + xml_file = None try: if sys.version_info[0] < 3: xml_file = open(os.path.expanduser(GRAMPS_FILENAME), "r") @@ -237,6 +238,9 @@ class RecentParser(object): if use_lock: fcntl.lockf(xml_file,fcntl.LOCK_UN) xml_file.close() + except IOError as err: + logging.warning("Unable to open recent file %s because %s", + os.path.expanduser(GRAMPS_FILENAME), str(err)) except Exception as err: logging.error("Recent file parse error %s", str(err)) if xml_file: