close

[Solved] Syntax: multiple statements found while compiling a single statement

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Syntax: multiple statements found while compiling a single statement in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Syntax: multiple statements found while compiling a single statement Error Occurs?

Today I get the following error Syntax: multiple statements found while compiling a single statement in python.

How To Solve Syntax: multiple statements found while compiling a single statement Error ?

  1. How To Solve Syntax: multiple statements found while compiling a single statement Error ?

    To Solve Syntax: multiple statements found while compiling a single statement Error In the shell, you can't execute more than one statement at a time:

  2. Syntax: multiple statements found while compiling a single statement

    To Solve Syntax: multiple statements found while compiling a single statement Error In the shell, you can't execute more than one statement at a time:

Solution 1

I had the same problem. This worked for me on mac:

echo "set enable-bracketed-paste off" >> ~/.inputrc

Solution 2

In the shell, you can’t execute more than one statement at a time:

>>> x = 5
y = 6
SyntaxError: multiple statements found while compiling a single statement

You need to execute them one by one:

>>> x = 5
>>> y = 6
>>>

When you see multiple statements are being declared, that means you’re seeing a script, which will be executed later. But in the interactive interpreter, you can’t do more than one statement at a time.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read