[Soc-2017-dev] Weekly Report #10 - Package Manager

dr. Sybren A. Stüvel sybren at blender.studio
Thu Aug 10 15:00:38 CEST 2017


On 09/08/17 21:55, Ellwood Zwovic wrote:
> The subprocess code does not include "import bpy". The multiprocessing 
> module (using the 'spawn' method) re-executes the *module which created 
> the subprocess* inside the subprocess, which currently has to import bpy 
> to get the path to the python interpreter executable.

So there are two cases when that module runs:

1) From within Blender, where it needs the bpy module to figure out the
Python executable to use.
2) From within the subprocess. In this case it is already running the
right Python executable, so it doesn't need to import bpy at all.

It would seem that you can handle this with:

try:
    import bpy
except ImportError:
    do_stuff_for_case_2()
else:
    do_stuff_for_case_1()

This then wouldn't require an in-between bpy-free module.

-- 

Sybren A. Stüvel

https://cloud.blender.org/
https://blender.studio/



More information about the Soc-2017-dev mailing list