i am not getting any output whenever i try to execute any basic command , in python using VS code.

- 492
- 3
- 14
-
Does this answer your question? [Invalid Syntax error when running python from inside Visual Studio Code](https://stackoverflow.com/questions/51540391/invalid-syntax-error-when-running-python-from-inside-visual-studio-code) – Random Davis Nov 11 '21 at 17:28
3 Answers
You seem to be trying to run python while already in python. Try opening a bash or cmd terminal and typing in python main3.py

- 128
- 5
Your Visual Studio Terminal has Python already opened, so when you try to execute the:
& "C:/python 39/python.exe" "C:/route_to_your_file.py"
Is trying to execute a line of code with this, something that has a bad python syntax.
You have two options:
Close python writing
exit()
and then run your python script with"C:/python 39/python.exe" main2.py
or"C:/python 39/python.exe" main3.py
Work directly with the application of python. In that case you can write your code directly on the terminal
print("hello world")
you can (but it is not recommended) import your files as packages, with:
import main2
import main3
Since you are new on python, I recommend you the first option.

- 492
- 3
- 14

- 7,438
- 1
- 5
- 13
-
@Adwet Anurag Dash Have you solved the problem? if this is helpful, could you accept this answer? thanks, and have a good day : ) – Steven-MSFT Nov 16 '21 at 02:32