2
$\begingroup$

So I've got this row of code: (line 115)

bpy.ops.anim.keyframe_insert(type='LocRotScale', confirm_success=True)

And it produces this error message:

Traceback (most recent call last):
  File "D:\{super secret path}\lab1.blend\lab1", line 115, in <module>
  File "D:\Windows Programs\Blender\2.78\scripts\modules\bpy\ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties:  enum "LocRotScale" not found in ()

Problem is, this exact code worked just a minute ago, i ran it once, cleared the keyframes from the time line and atempted to run the script again, then this error occured and its been this way ever since. I've tried both restarting blender, restarting the pc and even reinstalling blender (through the 64bit msi installer, repair mode).

I've even tried running the same code on a different machine, and that works.


Why do i get this error, and how do i fix it?

System Info:

OS: Windows 10 Home - v1607
Blender: v2.78a

$\endgroup$
  • $\begingroup$ My guess is you are in 'EDIT' mode. A quick test in py console reproduces a similar error. Should work Ok in 'OBJECT' or 'POSE' mode. $\endgroup$ – batFINGER Jan 31 '17 at 15:53
  • $\begingroup$ @batFINGER I LOVE YOU! Thank you so much! (post an answere with this and il give the the cred for the answere) $\endgroup$ – Olian04 Jan 31 '17 at 15:58
  • $\begingroup$ @batFINGER also... what kind of error message is that... it doesnt even have any thing to do with the actual error... $\endgroup$ – Olian04 Jan 31 '17 at 15:58
2
$\begingroup$

The context object needs to be in 'OBJECT' or 'POSE' mode to run bpy.ops.anim.keyframe_insert(type='LocRotScale', confirm_success=True)

Test in python console, in 'OBJECT' mode

>>> bpy.ops.anim.keyframe_insert(type='LocRotScale', confirm_success=True)
Info: Successfully added 9 keyframes for keying set 'LocRotScale'
{'FINISHED'}

In 'EDIT' mode:

>>> bpy.ops.anim.keyframe_insert(type='LocRotScale', confirm_success=True)
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "/home/batfinger/src/BlenderGIT/qtcreator_build/bin_current/2.78/scripts/modules/bpy/ops.py", line 189, in __call__
    ret = op_call(self.idname_py(), None, kw)
TypeError: Converting py args to operator properties:  enum "LocRotScale" not found in ('Available')
$\endgroup$

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.