Sorry if this is a stupid question, but I have not been able to solve it through the following related threads:
Visual studio code is not showing the ouput of python
How to execute Python code from within Visual Studio Code
I just installed VS Code for Windows v. 1.41 and I'm using Python 3.7.4 through an Anaconda distribution. After I upgraded VS Code, it will no longer print statements during a code run, only in the end will it print everything at once.
I tried to open "Task: Configure Default build task" and opening tasks.json, which has the following content:
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "python",
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"args": [
"${file}"
],
"group": {
"kind": "test",
"isDefault": true
}
}
]
}
As far as I understood, it should be either "echo" or "reveal" that should be responsible for the missing print statements during code execution, but both are set to true..
Does anyone have a solution for this? I would prefer to not use the Code Runner extension, if possible.
I've also been having this issue since my extension version was forcefully updated to version 2020.1.57204, which changed the "Run Python in Terminal" command as follows:
Use "conda run" (instead of using the "python.pythonPath" setting directly) when executing Python and an Anaconda environment is selected.
The command "conda run" is still somewhat experimental, and really shouldn't have been implemented in VSCode so soon. I'm on a mac, but the observed behavior is the same as yours, and when I use "conda run" in an external terminal, the stdout is still swallowed and then dumped all at once, so I put this down to an issue with conda, rather than an issue with VSCode (overeager implementation changes aside).
However, if "conda run" isn't being called when you run code, then unfortunately I don't know what's gone wrong in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With