Reputation: 113
I'm trying to figure out why I'm getting a syntax error when I try using this program. This code worked fine when I was using populating lists, however, I've decided to use an array as I can manipulate the data to my liking.
Here is the code:
#Frame Creation
frames=[]
for n in range (0, (workingframes*archnodes*3)):
frames.append( )
frames = array(frames) #generates array
frames = reshape(frames, ((archnodes*3),workingframes) #reshapes array
#Frame Population
for f in range (0, workingframes):
if f<=(workingframes/2):
for x in range (0, (archnodes)):
frames[(archnodes*3)].insert((archnodes*3), (archstartred[x]))
frames[(archnodes*3)+1].insert(((archnodes*3)+1),(archstartgrn[x]))
frames[(archnodes*3)+2].insert(((archnodes*3)+2),(archstartblu[x]))
for y in range (0, nodesperframe):
archstartred.pop()
archstartgrn.pop()
archstartblu.pop()
archstartred.insert(0, backred)
archstartgrn.insert(0, backgrn)
archstartblu.insert(0, backblu)
else:
for y in range (0, nodesperframe):
archstartred.pop(0)
archstartgrn.pop(0)
archstartblu.pop(0)
archstartred.append(backred)
archstartgrn.append(backgrn)
archstartblu.append(backblu)
for x in range (0, (archnodes)):
frames[(archnodes*3)].insert((archnodes*3), (archstartred[x]))
frames[(archnodes*3)+1].insert(((archnodes*3)+1),(archstartgrn[x]))
frames[(archnodes*3)+2].insert(((archnodes*3)+2),(archstartblu[x]))
I keep getting this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "backandforth3.py", line 99
for f in range (0, workingframes):
^
SyntaxError: invalid syntax
I have tried using different values for 'f'. I've tried removing the colons (which leads to other syntax errors.) What am I missing?
Upvotes: 0
Views: 563
Reputation: 19983
The problem is here:
frames = reshape(frames, ((archnodes*3),workingframes) #reshapes array
You have three (
and two )
. Python thinks that the reshape() call isn't over at the end of the line, so it proceeds down the file until it hits the for
and :
, which don't make sense inside a function call.
Upvotes: 4
Reputation: 4986
Missing parens:
frames = reshape(frames, ((archnodes*3),workingframes)
Upvotes: 2