diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-07-20 11:26:39 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-07-23 11:57:17 +0200 |
commit | 37abc22cf8d26fa3f7e282a1ee50a2a129d5a295 (patch) | |
tree | fbbfb92b09411215f5042d0481db4fca994e8440 /src | |
parent | ef9eb1dc7eb494e87f728af7caff8e5291cf320c (diff) | |
download | astra-37abc22cf8d26fa3f7e282a1ee50a2a129d5a295.tar.gz astra-37abc22cf8d26fa3f7e282a1ee50a2a129d5a295.tar.bz2 astra-37abc22cf8d26fa3f7e282a1ee50a2a129d5a295.tar.xz astra-37abc22cf8d26fa3f7e282a1ee50a2a129d5a295.zip |
Always log Python errors when importing/creating plugins
Diffstat (limited to 'src')
-rw-r--r-- | src/PluginAlgorithm.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/PluginAlgorithm.cpp b/src/PluginAlgorithm.cpp index a118f54..d6cf731 100644 --- a/src/PluginAlgorithm.cpp +++ b/src/PluginAlgorithm.cpp @@ -173,13 +173,19 @@ PyObject * getClassFromString(std::string str){ std::vector<std::string> items; boost::split(items, str, boost::is_any_of(".")); PyObject *pyclass = PyImport_ImportModule(items[0].c_str()); - if(pyclass==NULL) return NULL; + if(pyclass==NULL){ + logPythonError(); + return NULL; + } PyObject *submod = pyclass; for(unsigned int i=1;i<items.size();i++){ submod = PyObject_GetAttrString(submod,items[i].c_str()); Py_DECREF(pyclass); pyclass = submod; - if(pyclass==NULL) return NULL; + if(pyclass==NULL){ + logPythonError(); + return NULL; + } } return pyclass; } @@ -194,8 +200,6 @@ CPluginAlgorithm * CPluginAlgorithmFactory::getPlugin(std::string name){ if(pyclass!=NULL){ alg = new CPluginAlgorithm(pyclass); Py_DECREF(pyclass); - }else{ - logPythonError(); } }else{ alg = new CPluginAlgorithm(className); |