diff options
author | Martin Sivak <msivak@redhat.com> | 2008-04-10 15:32:06 +0200 |
---|---|---|
committer | Martin Sivak <msivak@redhat.com> | 2008-04-10 15:32:06 +0200 |
commit | 0cb521d21e24df5ffcf0f4db057a9294de518f17 (patch) | |
tree | d804c7afa83c0c36eb337de34017d139b677332e /pyfirstaidkit/plugins.py | |
parent | 9cda69702a3bf9006e1be56eef7936119f2b6072 (diff) | |
download | firstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.tar.gz firstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.tar.xz firstaidkit-0cb521d21e24df5ffcf0f4db057a9294de518f17.zip |
When plugin throws an exception during plugin discovery, ignore it (just print error message)
Diffstat (limited to 'pyfirstaidkit/plugins.py')
-rw-r--r-- | pyfirstaidkit/plugins.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pyfirstaidkit/plugins.py b/pyfirstaidkit/plugins.py index 33d6930..805667f 100644 --- a/pyfirstaidkit/plugins.py +++ b/pyfirstaidkit/plugins.py @@ -465,12 +465,15 @@ class PluginSystem(object): level = PLUGINSYSTEM, origin = self) moduleinfo = imp.find_module(m, [path]) module = imp.load_module(".".join([FirstAidKit.__name__, m]), *moduleinfo) + self._plugins[m] = module + self._reporting.debug("Module %s successfully imported with basedir %s" % + (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self) + except Exception, e: + self._reporting.error(message = "Module %s was NOT imported, because of %s" % + (m, str(e)), level = PLUGINSYSTEM, origin = self) finally: imp.release_lock() - self._plugins[m] = module - self._reporting.debug("Module %s successfully imported with basedir %s" % - (m, os.path.dirname(module.__file__)), level = PLUGINSYSTEM, origin = self) def list(self): """Return the list of imported plugins""" |