From f9645ad3e977996734f7cb324e234f87163b8dc4 Mon Sep 17 00:00:00 2001
From: Daniel Savchenko <dsavchenko@carlos.informatik.rwth-aachen.de>
Date: Mon, 30 Sep 2024 18:47:57 +0200
Subject: [PATCH] some adjustments

---
 PythonInterpreter/PythonInterpreter.cc | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/PythonInterpreter/PythonInterpreter.cc b/PythonInterpreter/PythonInterpreter.cc
index 315999fb..42fefd16 100644
--- a/PythonInterpreter/PythonInterpreter.cc
+++ b/PythonInterpreter/PythonInterpreter.cc
@@ -124,7 +124,7 @@ void PythonInterpreter::initPython() {
      std::cerr << "Initialize Threads ...";
   //#endif
 
-  //PyEval_InitThreads();
+  PyEval_InitThreads();
 
   //#ifdef PYTHON_DEBUG
      std::cerr << " Done" << std::endl;
@@ -166,8 +166,15 @@ void PythonInterpreter::initPython() {
       std::cerr << "Importing OpenFlipper core module ...";
     //#endif
 
-    py::module of_module(py::module::import("openflipper"));
-    main_namespace["openflipper"] = of_module;
+    try{
+      py::module of_module(py::module::import("openflipper"));
+      main_namespace["openflipper"] = of_module;
+    }
+    catch (py::error_already_set &e)
+    {
+      pyError(e.what());
+      return;
+    }
 
     //#ifdef PYTHON_DEBUG
       std::cerr << " Done" << std::endl;
@@ -272,13 +279,13 @@ bool PythonInterpreter::runScript(const QString& _script) {
   {
 
     //#ifdef PYTHON_DEBUG
-      std::cerr << "Initialize Python" << std::endl;
+      std::cout << "Initialize Python" << std::endl;
     //#endif
 
     initPython();
 
     //#ifdef PYTHON_DEBUG
-      std::cerr << "Done initializing Python" << std::endl;
+      std::cout << "Done initializing Python" << std::endl;
     //#endif
   }
   catch (py::error_already_set &e)
-- 
GitLab