]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModelHighAPI/ModelHighAPI_Tools.cpp
Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API. Debug of unit...
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Tools.cpp
index 8923fd6e13bf01788622a586a564361eccb44709..ca56b3712df2f167df528aa1c69361351e5336e9 100644 (file)
@@ -43,6 +43,9 @@
 
 #include <Events_InfoMessage.h>
 
+// Have to be included before std headers
+#include <Python.h>
+
 #include <algorithm>
 #include <iostream>
 
@@ -351,7 +354,10 @@ bool checkPythonDump()
   // close all before importation of the script
   aSession->closeAll();
   // execute the dumped
-  Config_ModuleReader::loadScript("check_dump");
+  PyGILState_STATE gstate = PyGILState_Ensure(); /* acquire python thread */
+  PyObject* PyFileObject = PyFile_FromString("./check_dump.py", "r");
+  PyRun_SimpleFileEx(PyFile_AsFile(PyFileObject), "./check_dump.py", 1);
+  PyGILState_Release(gstate); /* release python thread */
 
   // compare with the stored data
   anError = storeFeatures(