From: ageay Date: Mon, 25 Nov 2013 10:52:30 +0000 (+0000) Subject: Protection against no scipy presence. X-Git-Tag: V7_3_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=812e414d45d0350169dfca51aa6d8b0ffe7894e2;p=modules%2Fmed.git Protection against no scipy presence. --- diff --git a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i index c31ed371c..f71939e90 100644 --- a/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i +++ b/src/MEDCoupling_Swig/MEDCouplingDataArrayTypemaps.i @@ -435,7 +435,11 @@ PyObject *ToCSRMatrix(const std::vector >& m, int nbCols) t PyObject* pdict=PyDict_New(); PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins()); PyObject *tmp(PyRun_String("from scipy.sparse import csr_matrix", Py_single_input, pdict, pdict)); + if(!tmp) + throw INTERP_KERNEL::Exception("Problem during loading csr_matrix in scipy.sparse ! Is Scipy module available in present ?"); PyObject *csrMatrixCls=PyDict_GetItemString(pdict,"csr_matrix"); + if(!csrMatrixCls) + throw INTERP_KERNEL::Exception("csr_matrix not found in scipy.sparse ! Is Scipy module available in present ?"); PyObject *ret(PyObject_Call(csrMatrixCls,args,kw)); Py_DECREF(pdict); Py_XDECREF(tmp); Py_DECREF(args); Py_DECREF(kw); return ret;