comparison PyPlugScanner.cpp @ 70:6c755f3e1173

More fixes
author Chris Cannam
date Mon, 17 Nov 2014 14:07:00 +0000
parents 62dcaa5fe6f8
children 0120dac53a69
comparison
equal deleted inserted replaced
69:f5b8646494d2 70:6c755f3e1173
151 PyObject *pySource = PyString_FromString(classname.c_str()); 151 PyObject *pySource = PyString_FromString(classname.c_str());
152 152
153 //Import it as a module into the py interpreter 153 //Import it as a module into the py interpreter
154 PyObject *pyModule = PyImport_Import(pySource); 154 PyObject *pyModule = PyImport_Import(pySource);
155 PyObject* pyError = PyErr_Occurred(); 155 PyObject* pyError = PyErr_Occurred();
156 if (! pyError == 0) { 156 if (pyError) {
157 cerr << "ERROR: error importing source: " << classname << endl; 157 cerr << "ERROR: error importing source: " << classname << endl;
158 PyErr_Print(); 158 PyErr_Print();
159 Py_DECREF(pySource); 159 Py_DECREF(pySource);
160 Py_CLEAR(pyModule); // safer if pyModule==NULL 160 Py_CLEAR(pyModule); // safer if pyModule==NULL
161 return NULL; 161 return NULL;