There are some cases can lead to this issue, if it occered in the middle of the code it will be "IndentationError: expected an indented block" or "SyntaxError: invalid syntax", if it at the last line it may "SyntaxError: unexpected EOF while parsing":
Missing the body of "if","while"and"for" statement-->
root@nest:~/workplace# cat test.py
l = [1,2,3]
for i in l:
root@nest:~/workplace# python3 test.py
File "test.py", line 3
^
SyntaxError: unexpected EOF while parsing
Unclosed parentheses (Especially in complex nested states)-->
root@nest:~/workplace# cat test.py
l = [1,2,3]
print( l
root@nest:~/workplace# python3 test.py
File "test.py", line 3
^
SyntaxError: unexpected EOF while parsing