S_G
S_G

Reputation: 1

How can I get rid of the path shown in Vscode terminal while using Python?

When I try running a python code the output terminal displays the location where .py file is located in the white-colored text followed by the "&" sign and then the place where Python is installed as well as the file containing the Python code in blue text. I have no problem with the white text but earlier my VScode did not display this blue text, it's cluttering the output, is there any way to get rid of it?

https://i.sstatic.net/CUeL4.jpg

Upvotes: 0

Views: 3859

Answers (2)

Taylor
Taylor

Reputation: 11

I use this at the start of my code to delete the previous line;

print('\033c')

Pop it at the top and it deletes the path name in the terminal when ran.

Upvotes: 1

Jill Cheng
Jill Cheng

Reputation: 10344

At present, there is no direct way to omit the path information of "Terminal" in VS Code. This information shows us the path of the python interpreter used and the path of the executed file when executing the run command.

Workarounds:

  1. Please use the setting in "launch.json": "console": "internalConsole", then click F5 to debug the code, "DEBUG CONSOLE" will only display the result.

  2. You could use the VS Code extension "Code Runner" and use the settings in "settings.json": "code-runner.showExecutionMessage": false, then click "Run Code":

    enter image description here

Reference: Python debug configurations in Visual Studio Code.

Upvotes: 2

Related Questions