From ebb9286fd65d3cb1aae001080dbdb7102e7b49bf Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 11 Jan 2010 11:11:21 +0000 Subject: [PATCH] Fix for cmake + windows debug build crash on startup, PYTHONPATH needs to be set, Py_SetPythonHome seems insufficient. Not sure why this is needed or if there is a better solution, but couldn't find another one. --- source/blender/python/intern/bpy_interface.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 2c1edc965e9..611521073ef 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -299,9 +299,20 @@ void BPY_start_python_path(void) \nThis may make python import function fail\n"); #endif -#if 0 - BLI_setenv("PYTHONHOME", py_path_bundle); - BLI_setenv("PYTHONPATH", py_path_bundle); +#ifdef _WIN32 + /* cmake/MSVC debug build crashes without this, why only + in this case is unknown.. */ + { + char *envpath = getenv("PYTHONPATH"); + + if(envpath && envpath[0]) { + char *newenvpath = BLI_sprintfN("%s;%s", py_path_bundle, envpath); + BLI_setenv("PYTHONPATH", newenvpath); + MEM_freeN(newenvpath); + } + else + BLI_setenv("PYTHONPATH", py_path_bundle); + } #endif {