Skip to content
Snippets Groups Projects
Unverified Commit 38989b7c authored by Lars Bilke's avatar Lars Bilke
Browse files

[py] Added error message when trying to import ogs.callbacks from the embedded interpreter.

This can happen if you have the ogs-wheel installed but are running a local ogs binary. In this case use `import OpenGeoSys` or uninstall the wheel.
parent e5e649ce
No related branches found
No related tags found
No related merge requests found
......@@ -8,9 +8,11 @@
*
*/
#include <algorithm>
#include <pybind11/eval.h>
#include <pybind11/pybind11.h>
#include <algorithm>
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/BHEInflowPythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonBoundaryConditionModule.h"
#include "ProcessLib/BoundaryConditionAndSourceTerm/Python/PythonSourceTermModule.h"
......@@ -21,4 +23,12 @@ PYBIND11_MODULE(callbacks, m)
ProcessLib::pythonBindBoundaryCondition(m);
ProcessLib::bheInflowpythonBindBoundaryCondition(m);
ProcessLib::SourceTerms::Python::pythonBindSourceTerm(m);
pybind11::exec(R"(
try:
import OpenGeoSys
raise ImportError("The Python interpreter seems to be running inside the OGS binary, but you are about to import a Python module from OGS's Python bindings. Please do not import ogs.callbacks, but use the OpenGeoSys module, instead.")
except ModuleNotFoundError:
pass
)");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment