Python crashes when rendering with Workbench or Eevee

Hi,

I managed to build and use blender as a python module (Blender 2.80 with Python 3.7). However, when rendering a scene with Workbench or Eevee I get the following Python Error:

Process finished with exit code -1073741819 (0xC0000005)

Rendering with Cycles works perfectly. Rendering via Python from within blender works with all engines.

import bpy
bpy.ops.wm.open_mainfile(filepath="XPPU_2.blend")
bpy.context.scene.render.engine = 'BLENDER_WORKBENCH' #Not working
#bpy.context.scene.render.engine = 'CYCLES' #Working
bpy.context.scene.render.image_settings.file_format = "AVI_RAW"
bpy.context.scene.render.filepath = "//result.avi"
bpy.ops.render.render(animation=True)

Thanks for your help!

I’m experiencing the same! Blender 2.80, python 3.7 on Ubuntu 18.04, rendering with Workbench or Eevee gives me a Segmentation Fault. Cycles works just fine.

Any help greatly appreciated :pray:t3:

Since I also just tried and successfully build blender as a python module and also came across this:
I’m wondering if there’s some documentation about what’s supposed to be possible and what’s not with the blender python module version.

For a practical solution (if this is still relevant for the OP or someone else): Saving a blend file from the python module and then launching a actual blender process works with all rendering engines, here’s an example:

import subprocess
import tempfile


def manipulate_blend(blend_file, save_result_file):
    import bpy
    bpy.ops.wm.open_mainfile(filepath=blend_file)
    scene = bpy.context.scene
    cam = scene.objects['Camera']
    cam.location[2] -= 1
    bpy.ops.wm.save_mainfile(filepath=save_result_file)


def render_file(executable, blend_file, rendered_file):
    parameters = [executable, '-b', blend_file, '-o', rendered_file, '-f', '1']
    subprocess.call(parameters)


def main():
    with tempfile.TemporaryFile() as tmp_file:
        filename = tmp_file.name
        manipulate_blend("your_blend_file.blend", filename)
        render_file(
            'path/to/your/executable/blender',
            filename,
            'path/to/your/render/result/name_it'
        )


if __name__ == '__main__':
    main()