Page MenuHome

Add-on pane of user preferences disappears when bl_info is missing a required key in any add-on under scripts/addons.
Open, Needs TriagePublic

Description

System Information
Windows 10, NVIDIA GeForce GTX 1050

Blender Version
Broken: 2.79 hash: 5bd8ac9

Short description of error

Add-on pane of user preferences disappears when bl_info is missing keys in any add-on under scripts/addons. Errors logged to the console window:

Traceback (most recent call last):
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\startup\bl_ui\space_userpref.py", line 1372, in draw
    addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(refresh=False)]
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\modules\addon_utils.py", line 203, in modules
    mod_list.sort(key=lambda mod: (mod.bl_info["category"],
  File "C:\Program Files\Blender Foundation\Blender\2.79\scripts\modules\addon_utils.py", line 203, in <lambda>
    mod_list.sort(key=lambda mod: (mod.bl_info["category"],
KeyError: 'category'

Exact steps for others to reproduce the error

Not sure how to attach a blend file here since the error manifests when there is an add-on. A sample problematic add-on is:

scripts/addons/example.py

bl_info = {
  "name": "My Script",
  "description": "Single line explaining what this script exactly does.",
  "author": "John Doe, Jane Doe",
  "version": (1, 0),
  "blender": (2, 65, 0),
  "location": "View3D > Add > Mesh",
  "warning": "", # used for warning icon and text in addons panel
  "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
              "Scripts/My_Script",
  "tracker_url": "https://developer.blender.org/maniphest/task/edit/form/2/",
  #"support": "COMMUNITY",
  #"category": "Add Mesh"
}

I've attached pictures of the console window and of the user preferences add-on pane when this occurs.

It seems the error is pretty direct when looking at the source (scripts/modules/addon_utils.py, line 203). A simple fix might be to check the dictionary before accessing a key. A really nice fix in my opinion would be to point to the specific broken add-on in some way so nothing is silently skipped over.

Details

Type
Bug