git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem at the time of using editor


On 6/18/20 4:20 AM, Sourav Kundu wrote:
> when I am using the editor to write a long program and trying to run it the
> python command line showing it syntax error
> 


That almost certainly means there is a syntax error in your code.

Please provide some details - like the actual error text.

Note: for certain syntax errors, the error began previously, and the
line where the error is reported is the first time you can be sure there
actually was an error.  Consider:

print("This is a problem"

x = 12


The closing paren on the function call print() was omitted.  This will
give this result:

    x = 12
    ^
SyntaxError: invalid syntax



Clearly, "x = 12" does not contain a syntax error.  But paired parens
are allowed to span multiple lines, so Python keeps looking for the
closing one, and only when the syntax can't possibly be right any longer
does it give up and report an error.

A good Python-aware editor/IDE will do work to help show you where the
actual problem is.