[Tutor] Return error message for my script in Blender

Steven D'Aprano steve at pearwood.info
Sun Jul 18 03:11:40 CEST 2010


On Sun, 18 Jul 2010 07:11:19 am Andrew Martin wrote:
> I am new to Blender and Python (2.6 on vista) and was trying to
> follow a tutorial in the book Blender 2.49 Scripting by Michel
> Anders. I was trying to write a script that would create a user
> interface where the user could select various aspect of an insect and
> the code would create a polygonal bug. However, when I copied code
> exactly from the book, I got an error saying "'return' outside
> function". Here is the code I had in the text editor:
[...]
> Anybody know why I keep getting this error?

The return statement can only be inside a function. Here is an example:

def f():
    return "This is inside a function."

You have it outside a function, just like the error message says.


-- 
Steven D'Aprano


More information about the Tutor mailing list