You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These get thrown (and since #433 caught!) when errors happen in Python callbacks called from C++ using SWIG directors e.g. derived parameter calculation code. However, the code generated by SWIG to throw the exceptions looks like:
PyObject *error = PyErr_Occurred();
if (error) {
Swig::DirectorMethodException::raise("Error detected when calling 'DerivedParamFunc.__call__'");
}
So the contents of the error i.e. the message is totally ignored (meaning that, until I dug into this I was worried something was really wrong with this code but infact I had just forgotten to import numpy...). Extra code can be monkey-patched into the exception throwing code with (from google):
which prints out a standard Python error message. However I'm not really sure what all the PyErr_Fetch and PyErr_Restore business does and I'd rather pipe the errors back into an exception message or something but, that is definitely beyond my Python C API understanding (@alexdewar any thoughts as a more experienced Python C API wrangler?)
The text was updated successfully, but these errors were encountered:
These get thrown (and since #433 caught!) when errors happen in Python callbacks called from C++ using SWIG directors e.g. derived parameter calculation code. However, the code generated by SWIG to throw the exceptions looks like:
So the contents of the error i.e. the message is totally ignored (meaning that, until I dug into this I was worried something was really wrong with this code but infact I had just forgotten to
import numpy
...). Extra code can be monkey-patched into the exception throwing code with (from google):which prints out a standard Python error message. However I'm not really sure what all the
PyErr_Fetch
andPyErr_Restore
business does and I'd rather pipe the errors back into an exception message or something but, that is definitely beyond my Python C API understanding (@alexdewar any thoughts as a more experienced Python C API wrangler?)The text was updated successfully, but these errors were encountered: