1
$\begingroup$

While working on an addon we made a hook to our cmake script to add it to blender. (Faster development cycle) We run a fragment of Python via this incantation:

blender -b -P blender_install.py 

Here is the offending piece of code:

bpy.ops.wm.addon_disable(module=argv[1])
bpy.ops.wm.addon_remove(module=argv[1])

(The point is to uninstall the addon if another version was around.)

Blender gets quite creative:

Error: Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/wm.py", line 2155, in execute
    context.area.tag_redraw()
AttributeError: 'NoneType' object has no attribute 'tag_redraw'

location: /usr/share/blender/2.79/scripts/modules/bpy/ops.py:189

Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/wm.py", line 2155, in execute
    context.area.tag_redraw()
AttributeError: 'NoneType' object has no attribute 'tag_redraw'

location: /usr/share/blender/2.79/scripts/modules/bpy/ops.py:189

location: /usr/share/blender/2.79/scripts/modules/bpy/ops.py:189
Error: Traceback (most recent call last):
  File "/usr/share/blender/2.79/scripts/startup/bl_operators/wm.py", line 2155, in execute
    context.area.tag_redraw()
AttributeError: 'NoneType' object has no attribute 'tag_redraw'

location: /usr/share/blender/2.79/scripts/modules/bpy/ops.py:189

Info: Modules Installed (Audionodes) from '/home/gegaine/Audionodes/Audionodes.zip' into '/home/gegaine/.config/blender/2.79/scripts/addons'
Info: Modules Installed (Audionodes) from '/home/gegaine/Audionodes/Audionodes.zip' into '/home/gegaine/.config/blender/2.79/scripts/addons'

To my eye this looks like a crash having to do with background mode (the -b flag).

Am I doing something wrong or is this a bug with Blender's headless mode?

$\endgroup$
1
$\begingroup$

Not all Python operations are supported when running Blender in the background. The reasons for this is that operations are actions from user interface perspective. And some operations uses Graphical stuff like Window, Area or Region classes that do not exist when not having an UI.

The tag_redraw points me into that direction. You might try to fix the operation to make the wm.py not updating the UI at that point, but it not a bug.

$\endgroup$
  • $\begingroup$ (Context: We are trying to solve this issue together with Mörkö) wm.py is a part of Blender though. I understand that the headless mode isn't first priority, but doing something that doesn't necessarily need to update the GUI when the GUI isn't available shouldn't crash in my opinion. $\endgroup$ – ollpu Feb 6 '18 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.