Expected An Indented Block while loop problem

Hello

On the code below I keep getting the error message “Expected An Indented Block”. The code is supposed to create a list of points coorinates for points next to given ones for each loop. Its working one time, but im stuck on looping defined funcion.

IN[0] is given coordinates list
IN[1] is number of loops for the given list

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import sys
sys.path.append("C:\Program Files (x86)\IronPython 2.7\Lib")
import copy
from copy import deepcopy

a=IN[0]
b=IN[1]


def choose_point(a):
	
	x1 = deepcopy(a)
	x2 = deepcopy(a)
	y1 = deepcopy(a)
	y2 = deepcopy(a)
	z = deepcopy(a)

	for sub in x1:
    	sub[0] = sub[0] + 1
   
	for sub in x2:
    	sub[0] = sub[0] -1
   
	for sub in y1:
    	sub[1] = sub[1] - 1
   
	for sub in y2:
    	sub[1] = sub[1] -1
   
	for sub in z:
    	sub[2] = sub[2] +1

	final =[a,x1,x2,y1,y2,z]
	final_flat = sum(final, [])

	[list(i) for i in set(map(tuple, final_flat))]

	new_list = [x for x in final_flat if x not in a]

while b > 0: 
    choose_point(a) 
    b = x-1

OUT = new_list

And here is my dynamo script: trying python.dyn (5.6 KB)

Thanks in advance, its my first python try in dynamo.
Maciek.
`

Hello,

Can you provide more information on the variable ‘x’ in the line ‘b = x-1’ and where is it defined? Maybe I am missing something here!!

1 Like

Thank you for answer.
Probably its wrong, it should be I suppose b = b-1 its should be a loop counting number. When its 0 loop stops.

Hello @2shy
you have an error because you have mixed spaces and tabs for indentation (Never mix tabs and spaces)
to see them you can use DynamoStandBox 2.10 or any Python IDE

2 Likes

Thank you for your time, good to know! Now I don’t have this particular error anymore. Loop dosen’t work anyway but I will try debug it somehow.