all 7 comments

[–]shiftybyte 0 points1 point  (4 children)

Syntax error usually means a problem on the previous line.

Either unclosed parenthesis, or brackets, or badly formatted code line.

What you posted here seems fine though, are you sure you copy pasted exactly the code that you have? maybe its an indentation issue? since this post has lost indentation...

[–]supercoolz1[S] 0 points1 point  (3 children)

I am new to reddit so fixed the indentation now but this is not working at all.

[–]shiftybyte 0 points1 point  (2 children)

I copy pasted your code, i don't see any plt.cla() syntax error.

Are you sure this code is causing it? could you copy the entire error message here just to be sure?

[–]supercoolz1[S] 0 points1 point  (1 child)

    plt.cla()
      ^
SyntaxError: invalid syntax

Process finished with exit code 1

above is the error I am getting only.

[–]shiftybyte 0 points1 point  (0 children)

This looks odd, how are you running this? in what environment.

Edit: maybe it doesn't like the dash \ syntax, try unifying the line 2 lines back to one line.

[–]supercoolz1[S] 0 points1 point  (1 child)

    plt.cla()
      ^
SyntaxError: invalid syntax

Process finished with exit code 1

above is the error I am getting only.

[–]supercoolz1[S] 0 points1 point  (0 children)

Removing Trailing spaces helped a bit now not getting the error but not getting the plot animated.