Error with Python


#1

Excuse me are all 'start … with the python script I get the following error:


Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
File “”, line 11
sum = Math.Pow(X[i],2) + Math.Pow (Y[i],2) + Math.Pow(C,2)

^
SyntaxError: expected an indented block


I do not understand … can someone help?dynamo nota

thanks


#2

If you use small letters for all your math calls and the same size on your variables, it should work.

)7


#3

Thanks Jostein Olsendynamo nota
I tried as you say, but should not be
upload image … is right?
Thanks again for your cooperation


#4

Hi Alex,

@Olsen is right regarding the capitalization of the functions, also of your variables. You have to pay attention to this because Python is Case sensitive.

But the error that you’ve got is about indentation. Usually, when you are using a statement such as “for”, “if”, etc. you have to use indentation. In your case, Python doesn’t know what to execute inside the “for” loop. If you take a look at the picture of Olsen you will see that the next lines after “for” loop have a space at the beginning of the line (usually you can use the tab key). This space is the indent and the massage that you’ve got is saying that an indented line is expected.

Hope this is helpfully!

Lucian


#5

Also, to let Python go all together and use the built in design script language is more straight forward:

8


#6

Thanks Lucian, Thanks Jostein
everything works fine
Again, thank you for your cooperation