From 42def79a542f5e6f0ba5e5a7faf56c66f0403ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20St=C3=BCrz?= Date: Tue, 9 Sep 2025 12:39:53 +0200 Subject: [PATCH] Update python init depending on the py version --- libnymea-core/integrations/pythonintegrationplugin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libnymea-core/integrations/pythonintegrationplugin.cpp b/libnymea-core/integrations/pythonintegrationplugin.cpp index 758c97de..6ecd9810 100644 --- a/libnymea-core/integrations/pythonintegrationplugin.cpp +++ b/libnymea-core/integrations/pythonintegrationplugin.cpp @@ -265,9 +265,14 @@ void PythonIntegrationPlugin::initPython() // Initialize the python engine and fire up threading support qCDebug(dcPythonIntegrations()) << "Initializing Python engine"; - Py_InitializeEx(0); - PyEval_InitThreads(); +#if PY_VERSION_HEX < 0x03090000 + // deprecated. Called by Py_Initialize(). Removed in Py3.11 + // https://docs.python.org/3/c-api/init.html#c.PyEval_InitThreads + PyEval_InitThreads(); +#else + Py_InitializeEx(0); +#endif // Needs to be imported once to be able to use PyDateTime functions PyDateTime_IMPORT;