summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel M. Pelt <D.M.Pelt@cwi.nl>2015-07-20 11:26:39 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-07-23 11:57:17 +0200
commit37abc22cf8d26fa3f7e282a1ee50a2a129d5a295 (patch)
treefbbfb92b09411215f5042d0481db4fca994e8440 /src
parentef9eb1dc7eb494e87f728af7caff8e5291cf320c (diff)
downloadastra-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.cpp12
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);