Unexpected token 'while'

I’m getting an unexpected token error with this code. I don’t understand how ‘while’ would be unexpected.

# Enable Python support and load DesignScript library
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
textHeightPlusOne = IN[0]
textContentInput = IN[1]
columnMax = IN[2]

columnCalc = 0
textIndex = 0
columnCount = 0
columnLengths = []
columnStartingText = [0]

#Class for text that includes the lines needed the content and if the text is special
class textObject:
	def __init__(self, textLines, textContent, textSpecial):
		self.textLines = textLines
		self.textContent = textContent
		self.textSpecial = textSpecial

#Creating every text object from the inputs
textObj = []
textSpecialState = True

for i in range(len(textHeightPlusOne)):
	if textContentInput[i].rematch([r"SECTION \d", r"\D\.\s"]):
		textSpecialState = True
	else:
		textSpecialState = False
	textObj.append(textObject(textHeightPlusOne[i], TextCotentInput[i],textSpecialState)

		


#Main part to determine columns
while textIndex <= len(textHeightPlusOne) -1:
	if columnCalc > columnMax + 1:
		columnCount +=1
		textIndex -=1
		columnStartingText.append(textIndex)
		columnLengths.append(columnCalc - textHeightPlusOne[textIndex])
		columnCalc = 0
	else:
		columnCalc = columnCalc + textHeightPlusOne[textIndex]
		textIndex +=1
else:
	columnCount +=1
	columnLengths.append(columnCalc)
	
textCountLength = []

for i in range(len(columnStartingText)-1):
	textCountLength.append(columnStartingText[i + 1] - columnStartingText[i])
	

	
# Assign your output to the OUT variable.
OUT = columnCount, columnLengths, columnStartingText, textCountLength

Nvm Missing parenthesis on the append before the while.

2 Likes