8541: Crash following update: addon permission issue blocks re-starting gramps

There were two issues:

1. attempting to read a new addon file that wasn't readable
   threw an exception, aborted updating addons

2. global error catching didn't properly handle error code
   from an OSError
This commit is contained in:
Doug Blank 2015-05-05 13:25:20 -04:00 committed by Ross Gammon
parent b86ec4ffe9
commit 774855496f
2 changed files with 8 additions and 2 deletions

View File

@ -1096,7 +1096,13 @@ class PluginRegister(object):
continue continue
lenpd = len(self.__plugindata) lenpd = len(self.__plugindata)
full_filename = os.path.join(dir, filename) full_filename = os.path.join(dir, filename)
try:
fd = io.open(full_filename, "r", encoding='utf-8') fd = io.open(full_filename, "r", encoding='utf-8')
except Exception as msg:
print(_('ERROR: Failed reading plugin registration %(filename)s') % \
{'filename' : filename})
print(msg)
continue
stream = fd.read() stream = fd.read()
fd.close() fd.close()
if os.path.exists(os.path.join(os.path.dirname(full_filename), if os.path.exists(os.path.join(os.path.dirname(full_filename),

View File

@ -383,7 +383,7 @@ def __startgramps(errors, argparser):
% e.code, exc_info=True) % e.code, exc_info=True)
except OSError as e: except OSError as e:
quit_now = True quit_now = True
exit_code = e[0] or 1 exit_code = e.errno or 1
try: try:
fn = e.filename fn = e.filename
except AttributeError: except AttributeError: