[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [51008] trunk/blender/source/blender/ python/intern/bpy_interface.c: revert fix for [#31555] Username with special chars in Windows 7

Campbell Barton ideasman42 at gmail.com
Tue Oct 2 15:24:28 CEST 2012


Revision: 51008
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=51008
Author:   campbellbarton
Date:     2012-10-02 13:24:28 +0000 (Tue, 02 Oct 2012)
Log Message:
-----------
revert fix for [#31555] Username with special chars in Windows 7

this breaks and causes bug: [#32720], where sys.stdout becomes invalid and print() does nothing.

On investigation - python is not getting the environment variable from blender (aparently because its a DLL?) so this should be resolved rather then overwriting sys.stdout.

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	2012-10-02 13:13:26 UTC (rev 51007)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c	2012-10-02 13:24:28 UTC (rev 51008)
@@ -251,6 +251,10 @@
 	 * an error, this is highly annoying, another stumbling block for devs,
 	 * so use a more relaxed error handler and enforce utf-8 since the rest of
 	 * blender is utf-8 too - campbell */
+
+	/* XXX, update: this is unreliable! 'PYTHONIOENCODING' is ignored in MS-Windows
+	 * when dynamically linked, see: [#31555] for details.
+	 * Python doesn't expose a good way to set this. */
 	BLI_setenv("PYTHONIOENCODING", "utf-8:surrogateescape");
 
 	/* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' to
@@ -264,15 +268,6 @@
 
 	Py_Initialize();
 
-#ifdef WIN32
-	/* this is disappointing, its likely a bug in python?
-	 * for some reason 'PYTHONIOENCODING' is ignored in windows
-	 * see: [#31555] for details. */
-	PyRun_SimpleString("import sys, io\n"
-	                   "sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n"
-	                   "sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='surrogateescape', line_buffering=True)\n");
-#endif  /* WIN32 */
-
 	// PySys_SetArgv(argc, argv); // broken in py3, not a huge deal
 	/* sigh, why do python guys not have a (char **) version anymore? */
 	{




More information about the Bf-blender-cvs mailing list