Zfuture It's not obvious to me. But an invalid syntax error is akin to grammatical and punctuation errors; it could be caused by something as simple as missing or having an extra colon or a comma or an equal sign somewhere, or having an incorrect sequence of characters.
No-thinking-approaches to narrowing down where the issue lies for this kind of error:
1) Paste it in an editor or IDE that has a Python Interpreter, and it should catch it and tell you exactly what line is causing the issue.
2) Do things like open""" and close""" or # out sections, and then run the whole thing to see if it gets parsed correctly without any errors. I.e.:
"""
is this the line causing an issue?
or is it this line?
"""
or
#maybe it's this line that's causing the issue
Let's say you want to check if it's the last 4 lines after that if-statement that's causing an issue. You can include something you know WILL work, such as:
if-statement blah blah blah:
print 'derpderp'
"""
is this the line causing an issue?
or is it this line?
"""
Once you narrow it down, or it's still not obvious, THEN exert mental power, lol.