Fix undefined variable reference, make separate not-loaded warning

Thanks to Pat Lefebre for reporting the error.

svn: r21179
This commit is contained in:
John Ralls 2013-01-20 19:35:28 +00:00
parent f479a876e3
commit fe775c19bd

View File

@ -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: