3
$\begingroup$

I am developing an addon for Blender 2.69, and a specific python library call is causing Blender to crash. I have tried to enclose the call in a try-catch block, but it still crashes. As a result, I can't view the error details in the system console.

Is there any way I could print the stack trace to a file before crashing, or any other way I could access this information?

The problematic library call is intriguing on its own, and I've posted it as a Stack Overflow question here: PIL Image.save() function fails in Blender python

$\endgroup$

1 Answer 1

5
$\begingroup$

If you really want to invest time to find why it crashes you might be best doing your own debug build of Blender and checking exactly where it crashes in a debugger.

Failing that, blender does write a stack trace on exit (on Linux at least).

Try run blender from a terminal and on crash you will get a message like...

Writing: /tmp/blender.crash.txt

# Blender 2.69 (sub 9), Unknown revision
bpy.data.window_managers["WinMan"].(null) = 'F8'  # Property
bpy.data.window_managers["WinMan"].(null) = 'F8'  # Property

# backtrace
/src/blender/blender.bin() [0x709cf1]
/src/blender/blender.bin() [0x709f7a]
/usr/lib/libc.so.6(+0x353e0) [0x7f617dd343e0]
/src/blender/blender.bin() [0x141ca0c]
/src/blender/blender.bin(RNA_property_type+0x27) [0x141d77e]
/src/blender/blender.bin(RNA_property_collection_begin+0x2f) [0x1424665]
/src/blender/blender.bin(WM_operator_properties_sanitize+0x55) [0x727453]
/src/blender/blender.bin() [0x720de3]
/src/blender/blender.bin(WM_keyconfig_update+0x9f) [0x7240bb]
/src/blender/blender.bin(wm_event_do_handlers+0xa03) [0x718d6a]
/src/blender/blender.bin(WM_main+0x33) [0x70da43]
/src/blender/blender.bin(main+0x44d) [0x70c971]
/usr/lib/libc.so.6(__libc_start_main+0xf5) [0x7f617dd20b05]
/src/blender/blender.bin() [0x709009]

Or you could look into Pythons faulthandler module, which can catch segfaults and report information about this too.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .