Page MenuHome

Calling the Alembic export/importer from a .py script crashes Blender
Closed, ResolvedPublic

Description

It seems like calling the alembic exporter and the alembic importer from a .py script crashes with "Error : EXCEPTION_ACCESS_VIOLATION"

If you comment the importer part, the script wont crash Blender, however exporting and importing has some weird behavior.

I tested this issue on Linux as well, the crash happens the exact same way on Linux too.

  • Add the addon below (add it as an .py addon file to your scripts folder)
  • Enable the addon (AlembicCrashes)
  • Add a cube
  • Select the cube
  • Run bpy.ops.object.alembiccrash()

This is a stripped down version of the script I was trying to write, but I cant seem to pass this stage of importing. The path in there is relative but feel free to add real paths, the result wont change.

import bpy
import os
bl_info = {
    "name" : "AlembicCrashes",
    "author" : "kursad",
    "description" : "",
    "blender" : (2, 80, 0),
    "location" : "",
    "warning" : "",
    "category" : "Generic"
}

class AlembicCrashesOperator(bpy.types.Operator):
    bl_idname = "object.alembiccrash"
    bl_label = "CrashAlembic"

    def execute(self, context):

        bpy.ops.wm.alembic_export(filepath="Cube.abc", selected=True)
        bpy.ops.wm.alembic_import(filepath="Cube.abc")

        return {'FINISHED'}


def register():
    bpy.utils.register_class(AlembicCrashesOperator)

def unregister():
    bpy.utils.unregister_class(AlembicCrashesOperator)

Event Timeline

kursad k (kursadk) updated the task description. (Show Details)
kursad k (kursadk) renamed this task from Calling the alembic export/importer from a .py script crashes Blender to Calling the Alembic export/importer from a .py script crashes Blender.

trace from Linux

# backtrace
./blender(BLI_system_backtrace+0x1d) [0x1b865ad]
./blender() [0x1152159]
/lib/x86_64-linux-gnu/libc.so.6(+0x35fc0) [0x7f35ee732fc0]
./blender(BKE_view_layer_base_deselect_all+0) [0x1965340]
./blender() [0x163756c]
./blender(wm_jobs_timer+0x10c) [0x116441c]
./blender(wm_window_process_events+0x1af) [0x117624f]
./blender(WM_main+0x18) [0x1152b58]
./blender(main+0x31e) [0x10b880e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7f35ee71fb17]
./blender(_start+0x2a) [0x114ec3a]
Bastien Montagne (mont29) triaged this task as Confirmed, Medium priority.

I am wondering if someone else also do a basic test with this to see, it crashes their Blender as wel. I cant find why this crashes Blender.

bpy.ops.wm.alembic_export(filepath="Cube.abc", selected=True)
bpy.ops.wm.alembic_import(filepath="Cube.abc")

Here you're doing a background export, and immediately an import of a not-yet-completely-written file. Try adding as_background_job=False to the export call.

Hi

Thanks for the follow up, I am going to test it and follow up here.

as_background_job=False is no longer necessary, as this is now the default when executing the import/export operators from Python.