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

Ellwood Zwovic gandalf3 at blendermonkey.com
Fri Aug 11 08:27:20 CEST 2017


On 08/10/2017 06:00 AM, dr. Sybren A. Stüvel wrote:
> 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.
>
Ah, that is nicer. Works for me on linux, but I still need to test on 
windows to be sure (I'm not sure what happened to the path issue I was 
having before).
Unfortunately windows runs absurdly slow in my VM, so I won't know for a 
little bit yet..


More information about the Soc-2017-dev mailing list