Reputation: 21
I just installed Visual Studio Code and did a two-line code as per the tutorial:
msg = "Hello, World!"
print(msg)
When running the code, the following error message is displayed:
The terminal process terminated with exit code: {0}
If I click on the terminal menu, and then new terminal, it briefly appears and vanishes with same error message.
Upvotes: 2
Views: 5669
Reputation: 171
Try running the program by pushing the green arrow in Visual Studio Code. I think what you’re seeing is that the code completes and the terminal closes. It’s not waiting for you to do anything, so it’s finished.
Assuming you’re in Windows, the easiest way to get around this is to run the code within the Visual Studio itself.
Another handy way to use PowerShell. Open PowerShell. Navigate to the directory were you have saved the program and type “python yourfilename.py”. The program will still end quickly, but you will be able to see what it printed.
Finally, you can use Python IDLE. IDLE is an IDE, like VS Code, but specifically for Python. You can open your program with IDLE and it will display the results in a similar way that it would appear in PowerShell.
There are a lot of different options. It’s confusing when you’re first trying to get your bearings. You’ll find something that feels good for you.
Upvotes: 1