Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. unexpected token '<newline>

loop
designscript
python

#1

Hi everyone,

I’m new to Dynamo and programming world. I wrote a dynamo script that it is not giving me the output that I really want so (I couldn t recognize how to fix iteration/loops with the help of dynamo nodes)so I tried to wrote a python script. Whenever I try to run it I get back this warning:IronPythonEvaluator.EvaluateIronPythonScript operation failed.
unexpected token ‘’.
P.S: the script is about to place panels on a selected path and if is not working with that certain panel decrease the panel length with 10 mm until it find the solution![placement of panels along a path trial|690x467


#2

I wonder if this node would not be useful for what you seek:


#3

first, in Python is it emphasized that the code should be readable. If you gave your variables some elaborating names then both you and those you ask for help, would understand what you try to achieve

next, when asking for help, please upload your .dyn file and preferably make the code available in text form like this…

import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')

path_length = IN[0]
panel = 3000

def func(panel, c = 0):
    x = path_length/panel
    y = math.floor(x)
    z = x-y
    a = z*panel
    gaps = y-1
    c = gaps/a
    if 10 >= c and c <= 30:
        d = c + panel
    else:
        func(panel - 10)

OUT = d