I'm trying to run a simple print script in Visual Studio Code with Python, but nothing shows up in terminal or output
Question:
Answers:
I think you have to run the file through python hi.py to show the output. Did you try it?
If you run the script from VSCode UI, you should see the output in OUTPUT
tab. In your screenshot you are checking in TERMINAL
Nonetheless, as others have mentioned, you can execute it through the TERMINAL
as well, typing python hi.py
You are not running your terminal in the same path where the file is located. The easiest way to go is to open the folder that contains your file using vscode. Right click on the folder and chose "Open with Code". Then your terminal will run there by default.
Otherwise change the directory to the correct location using something likecd "OneDrive/documents/python stuff"
.
Or specify the path of the file you are trying to run. Something like this:> python "/OneDrive/documents/python stuff/file_name.py"
I think you have to run the file through python hi.py to show the output. Did you try it?
If you run the script from VSCode UI, you should see the output in OUTPUT
tab. In your screenshot you are checking in TERMINAL
Nonetheless, as others have mentioned, you can execute it through the TERMINAL
as well, typing python hi.py
You are not running your terminal in the same path where the file is located. The easiest way to go is to open the folder that contains your file using vscode. Right click on the folder and chose "Open with Code". Then your terminal will run there by default.
Otherwise change the directory to the correct location using something likecd "OneDrive/documents/python stuff"
.
Or specify the path of the file you are trying to run. Something like this:> python "/OneDrive/documents/python stuff/file_name.py"