[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25896] trunk/blender/source/blender/ python/intern/bpy_interface.c: Fix for cmake + windows debug build crash on startup, PYTHONPATH needs to be set, Py_SetPythonHome seems insufficient.

Brecht Van Lommel brecht at blender.org
Mon Jan 11 12:11:22 CET 2010


Revision: 25896
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25896
Author:   blendix
Date:     2010-01-11 12:11:21 +0100 (Mon, 11 Jan 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_interface.c

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c	2010-01-11 10:48:41 UTC (rev 25895)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c	2010-01-11 11:11:21 UTC (rev 25896)
@@ -299,9 +299,20 @@
 			   \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
 
 	{





More information about the Bf-blender-cvs mailing list