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 1d002b3218
commit c4802bd210

View File

@ -219,6 +219,7 @@ class RecentParser(object):
self.recent_files = [] self.recent_files = []
#Python3's expat wants bytes, Python2's wants a string. #Python3's expat wants bytes, Python2's wants a string.
xml_file = None
try: try:
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
xml_file = open(os.path.expanduser(GRAMPS_FILENAME), "r") xml_file = open(os.path.expanduser(GRAMPS_FILENAME), "r")
@ -237,6 +238,9 @@ class RecentParser(object):
if use_lock: if use_lock:
fcntl.lockf(xml_file,fcntl.LOCK_UN) fcntl.lockf(xml_file,fcntl.LOCK_UN)
xml_file.close() 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: except Exception as err:
logging.error("Recent file parse error %s", str(err)) logging.error("Recent file parse error %s", str(err))
if xml_file: if xml_file: