I have a minimal addon example, which I try to install and uninstall through command line (headless blender execution), but get an error in the title.
I install it using commands:
bpy.ops.preferences.addon_install(overwrite=True, filepath='{path_addon}')
bpy.ops.preferences.addon_enable(module='{addon_name}')
bpy.ops.wm.save_userpref()
without a problem, and I can disable it successfully too:
bpy.ops.preferences.addon_disable(module='{addon_name}')
bpy.ops.wm.save_userpref()
But when I try removing it:
bpy.ops.preferences.addon_remove(module='{addon_name}')
I always get this error:
Blender 3.0.0 (hash f1cca3055776 built 2021-12-03 00:44:02)
Read prefs: C:\Users\<username>\AppData\Roaming\Blender Foundation\Blender\3.0\config\userpref.blend
addon_utils.disable: test addon not disabled
Error: Python: Traceback (most recent call last):
File "C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\startup\bl_operators\userpref.py", line 796, in execute
context.area.tag_redraw()
AttributeError: 'NoneType' object has no attribute 'tag_redraw'
location: C:\Program Files\Blender Foundation\Blender 3.0\3.0\scripts\modules\bpy\ops.py:132
Is it a known bug? I have a problem with a large addon, but trying to figure it out I got stuck at this.
I’ve seen this stackexchange post, but it’s quite old and doesn’t really answer my question: python - What does this error mean and is it a Blender bug? - Blender Stack Exchange