0
$\begingroup$
>>> a = bpy.data.objects['Armature.001'].data
>>> a.edit_bones('m_avg_Pelvis')
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
TypeError: 'bpy_prop_collection' object is not callable

>>> bpy.ops.object.mode_set(mode='EDIT')
{'FINISHED'}

>>> pb = a.edit_bones['m_avg_Pelvis']
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
KeyError: 'bpy_prop_collection[key]: key "m_avg_Pelvis" not found'

>>> a.bones.keys()
['m_avg_root', 'm_avg_Pelvis', 'm_avg_L_Hip', 'm_avg_L_Knee', 'm_avg_L_Ankle', 'm_avg_L_Foot', 'm_avg_R_Hip', 'm_avg_R_Knee', 'm_avg_R_Ankle', 'm_avg_R_Foot', 'm_avg_Spine1', 'm_avg_Spine2', 'm_avg_Spine3', 'm_avg_Neck', 'm_avg_Head', 'm_avg_L_Collar', 'm_avg_L_Shoulder', 'm_avg_L_Elbow', 'm_avg_L_Wrist', 'm_avg_L_Hand', 'm_avg_R_Collar', 'm_avg_R_Shoulder', 'm_avg_R_Elbow', 'm_avg_R_Wrist', 'm_avg_R_Hand']

>>> 

Above is my blender python output. As you can see, m_avg_Pelvis actually exists in the keys, but a KeyError is raised when running a.edit_bones['m_avg_Pelvis'].

Why does this error occur?

$\endgroup$
3
  • 1
    $\begingroup$ You're right that you need to be in edit mode, but make sure the armature object is the active object first, or you might be editing something else. $\endgroup$
    – scurest
    Jan 1, 2022 at 7:42
  • $\begingroup$ can you share a blend file that has been reduced to just the armatures? (You appear to have more than one.) (How to add a blend file) I suspect, however that @scurest is right and your problem is that Armature.001 isn't the active object. $\endgroup$ Jan 1, 2022 at 19:57
  • $\begingroup$ thank u guys. I fixed by remove all other amatures $\endgroup$ Jan 3, 2022 at 7:40

0

You must log in to answer this question.

Browse other questions tagged .