8000 Additional debug output if python module loading fails · EmmiOcean/matplotlib-cpp@05087cf · GitHub
[go: up one dir, main page]

Skip to content

Commit 05087cf

Browse files
Patric SchmitzBenno Evers
Patric Schmitz
authored and
Benno Evers
committed
Additional debug output if python module loading fails
1 parent d42a969 commit 05087cf

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

matplotlibcpp.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,15 @@ struct _interpreter {
122122
PyObject* cmname = PyString_FromString("matplotlib.cm");
123123
PyObject* pylabname = PyString_FromString("pylab");
124124
if (!pyplotname || !pylabname || !matplotlibname || !cmname) {
125-
throw std::runtime_error("couldnt create string");
125+
throw std::runtime_error("couldnt create string");
126126
}
127127

128 6E5B 128
PyObject* matplotlib = PyImport_Import(matplotlibname);
129129
Py_DECREF(matplotlibname);
130-
if (!matplotlib) { throw std::runtime_error("Error loading module matplotlib!"); }
130+
if (!matplotlib) {
131+
PyErr_Print();
132+
throw std::runtime_error("Error loading module matplotlib!");
133+
}
131134

132135
// matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
133136
// or matplotlib.backends is imported for the first time

0 commit comments

Comments
 (0)
0