| 175 | } |
| 176 | |
| 177 | void mitk::PythonContext::Execute(const std::string &expression) |
| 178 | { |
| 179 | py::gil_scoped_acquire gil; |
| 180 | |
| 181 | try |
| 182 | { |
| 183 | py::exec(expression, m_Impl->Dictionary); |
| 184 | } |
| 185 | catch (py::error_already_set& e) |
| 186 | { |
| 187 | mitkThrow() << "An error occurred while executing Python code: " << e.what(); |
| 188 | } |
| 189 | } |
| 190 | |
| 191 | void mitk::PythonContext::ExecuteFile(const fs::path& filePath) |
| 192 | { |