Search code examples
visual-studio-codepylint

Visual Studio Code [pylint] E0001:invalid syntax (<string>, line 218)


I am using VS Code for writing a python script and it was running well until i received an error that has no connection to the syntax and now I am not more able to run the script that was working fine.

Here is an image with the VS Code interface and the error I get when I try to run the script.

When I hover the cursor on red undeline at the beginning of the line it shows this message: [pylint] E0001:invalid syntax (, line 218)


Solution

  • Line 213 has an unterminated open bracket '('. These are reported as syntax errors on lines below, as they could be terminated on lines below. Brackets are used for line continuation in python.

    The preferred way of wrapping long lines is by using Python's implied line continuation inside parentheses, brackets and braces

    https://www.python.org/dev/peps/pep-0008/