[Bf-blender-cvs] [c9ec8ba88fb] soc-2017-package_manager: Add explanation for multiprocessing context

gandalf3 noreply at git.blender.org
Tue Aug 29 11:45:33 CEST 2017


Commit: c9ec8ba88fb87f94a512b4aa820796758146cf8c
Author: gandalf3
Date:   Mon Aug 28 20:57:24 2017 -0700
Branches: soc-2017-package_manager
https://developer.blender.org/rBc9ec8ba88fb87f94a512b4aa820796758146cf8c

Add explanation for multiprocessing context

===================================================================

M	release/scripts/startup/bl_operators/package.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/package.py b/release/scripts/startup/bl_operators/package.py
index 427225ad9b9..061161249b1 100644
--- a/release/scripts/startup/bl_operators/package.py
+++ b/release/scripts/startup/bl_operators/package.py
@@ -22,7 +22,13 @@ else:
     from collections import OrderedDict
     import multiprocessing
 
-    mp_context = multiprocessing.get_context('spawn')
+    # Under windows, multiprocessing must start a new process entirely. It
+    # expects sys.executable to point to python, but in blender sys.executable
+    # points to blender's executable. We can override this with set_executable,
+    # but this acts globally unless we make a special context.
+    # Also see:
+    # https://docs.python.org/3.6/library/multiprocessing.html#multiprocessing.set_executable
+    mp_context = multiprocessing.get_context()
     mp_context.set_executable(bpy.app.binary_path_python)
 
     class SubprocMixin:



More information about the Bf-blender-cvs mailing list