mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
py3: Fix load_plugin() not handling load failures
This commit is contained in:
parent
1c846769db
commit
48d4c73f88
@ -203,12 +203,13 @@ class Plugins(collections.Mapping):
|
|||||||
del sys.modules[name]
|
del sys.modules[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
plugin_err = u''
|
||||||
try:
|
try:
|
||||||
p, err = importlib.import_module(name), ''
|
p = importlib.import_module(name)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
p = None
|
p = None
|
||||||
err = str(err)
|
plugin_err = unicode_type(err)
|
||||||
self._plugins[name] = (p, err)
|
self._plugins[name] = p, plugin_err
|
||||||
sys.path.remove(sys.extensions_location)
|
sys.path.remove(sys.extensions_location)
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user