Skip to content

Commit

Permalink
try to return exception information when numpy fails to import
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Oct 1, 2012
1 parent fb3d0a1 commit 8c15723
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/plang/Invocation.cpp
Expand Up @@ -61,7 +61,12 @@ void Invocation::numpy_init()
// this macro is defined be NumPy and must be included
if (_import_array() < 0)
{
throw python_error("unable to initialize NumPy");
PyObject *ptype, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
char *message = PyString_AsString(pvalue);
std::ostringstream oss;
oss << "unable to initialize NumPy with error '" << std::string(message) << "'";
throw python_error(oss.str());
}
}

Expand Down

0 comments on commit 8c15723

Please sign in to comment.