0
$\begingroup$

I am working on a blender addon. After working with the addon enabled in the blender window. I start seeing the following bug in the console.

RuntimeError: class CONSOLE_OT_banner, function execute: incompatible return value , , Function.result expected a set, not a NoneType
Error: Python: RuntimeError: class CONSOLE_OT_banner, function execute: incompatible return value , , Function.result expected a set, not a NoneType

The error goes away if I delete the userpref.blend file and restart blender. Has anybody else faced this issue or have any suggestions to debug?

$\endgroup$
1
  • $\begingroup$ For more complicated issues, it will be helpful to post the code so others can point at the exact location of the problem. $\endgroup$ Mar 14 at 20:29

1 Answer 1

1
$\begingroup$

Without looking at the full code I will make an educated guess. Don't forget to add return{'FINISHED'} at the bottom of your execute(self, context) function, like this:

def execute(self, context):
    # do something
    
    return {'FINISHED'}

When you don't specify a return value for a function, Python returns None by default, so I believe that to be the problem here. Don't forget to check out the Python templates that Blender offers in the Script Editor.

$\endgroup$
2
  • $\begingroup$ I am aware of return type and did check my code after your post. I always return {"FINISHED"} at the end of execute function. I am wondering what happens if my code in the execute fails. Would blender automatically return {"CANCELLED"} or other valid return value? Or I need to do error checking and return a valid value? $\endgroup$
    – arpit
    Mar 14 at 21:49
  • $\begingroup$ Well, the error above says specifically that None is being returned instead of a Set (like {'FINISHED'} OR {'CANCELLED'}. Using curly braces {} is how you define a Set in Python, so for some reason you never reach the correct return value. $\endgroup$ Mar 15 at 0:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .