From 747e0f14cf56827945e5fcfb4dd7fb3a69a13833 Mon Sep 17 00:00:00 2001 From: caremoli Date: Thu, 3 Feb 2011 17:14:56 +0000 Subject: [PATCH] CCAR: fix the use of Py_GetProgramName(file) when initializing embedded Python. If SALOME_PYTHON environment variable (path to the installed python executable) is defined use it for the file argument. This variable can be used in place of the dangerous use of PYTHONHOME. --- src/Container/Container_init_python.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Container/Container_init_python.cxx b/src/Container/Container_init_python.cxx index 3a532b222..df48142b7 100644 --- a/src/Container/Container_init_python.cxx +++ b/src/Container/Container_init_python.cxx @@ -52,7 +52,9 @@ void KERNEL_PYTHON::init_python(int argc, char **argv) MESSAGE("================================================================="); // set stdout to line buffering (aka C++ std::cout) setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); - Py_SetProgramName(argv[0]); + char* salome_python=getenv("SALOME_PYTHON"); + if(salome_python != 0) + Py_SetProgramName(salome_python); Py_Initialize(); // Initialize the interpreter PySys_SetArgv(argc, argv); KERNEL_PYTHON::_interp = PyThreadState_Get()->interp; -- 2.39.2