1

I am a beginner with VS Code, Done new installation and facing following problem:

SyntaxError: invalid syntax
>>> & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
  File "<stdin>", line 1
    & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
    ^
SyntaxError: invalid syntax
>>> print("hhi")
hhi
>>> & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
  File "<stdin>", line 1
    & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
    ^
SyntaxError: invalid syntax
>>> & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
  File "<stdin>", line 1
    & C:/ProgramData/Anaconda3/python.exe c:/Users/lenovo/Desktop/python/python1.py
    ^
SyntaxError: invalid syntax
>>> print("hi")
hi
>>>
4
  • Why are you trying to evaluate a &? Commented May 24, 2020 at 13:37
  • Is this a syntax error in VSCode or python? Commented May 24, 2020 at 13:38
  • its a sytax error in VSCODE Commented May 24, 2020 at 14:02
  • "&" i have not given anywhere where from vscode is picking i dont know Commented May 24, 2020 at 14:04

1 Answer 1

15

It's happening because you didn't exit the Python REPL before trying to send commands to the terminal. Exit the REPL (exit() works), and then you will be back at your terminal and those commands will start working.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.