- /* Get the 'Decoder' class as Python object. */
- py_res = PyObject_GetAttrString(py_mod, "Decoder"); /* NEWREF */
- if (!py_res) {
- if (PyErr_Occurred())
- PyErr_Print(); /* Returns void. */
- Py_XDECREF(py_mod);
- fprintf(stderr, "Decoder class not found in PD module %s\n", name);
- return SRD_ERR_PYTHON; /* TODO: More specific error? */
+ /* Import the Python module. */
+ if (!(d->py_mod = PyImport_ImportModule(name))) {
+ /* TODO: report exception message/traceback to err/dbg */
+ srd_dbg("import failed");
+ PyErr_Clear();
+ ret = SRD_ERR_PYTHON;
+ goto err_out;