How to fix an issue of VS code terminal prompt adding an extra line to it after the program is executed

126 Views Asked by At

enter image description hereMy VS Code is appending the miniconda3 path to the Power Shell prompt every time I execute any code. This causes the PS prompt to be super long.

e.g.

PS C:\Users\name\Projects\Python Tutorials> **& C:/Users/name/miniconda3/python.exe "c:/Users/name/Projects/Python Tutorials/Instance_in_Python.py**"

I would like the command prompt to end at:

PS C:\Users\name\Projects\Python Tutorials>

and print the program's output and not append this extra line after it:

**& C:/Users/name/miniconda3/python.exe "c:/Users/name/Projects/Python Tutorials/Instance_in_Python.py**

I have attached a screenshot of the PS prompt in VS Terminal for your perusal.

I have also searched this forum for any possible solution for this issue but unfortunately could not find any.

Is this due to the location of my Python file and the project files or something else? Any help in reducing this command prompt line would be highly appreciated.

2

There are 2 best solutions below

3
JialeDu On BEST ANSWER

My VS Code is appending the miniconda3 path to the Power Shell prompt every time I execute any code. This causes the PS prompt to be super long.

vscode uses the system terminal as the integrated terminal, that's how it works. There's nothing wrong with that.

If you insist on cleaner output, you can use Code Runner and keep the following settings.

    "code-runner.runInTerminal": false,
    "code-runner.clearPreviousOutput": true,
    "code-runner.showExecutionMessage": false,

enter image description here

But I still recommend you to use the official extension Python (Run Python File) to execute the script.

1
Variegatus Bradypus On

I am not sure if you would be happier with this, but a VScode extension code-runner looks well-known.

enter image description here

Installing this extension enables you to see [Run Code] option with your python script, and at least it makes you save lines from including whole absolute path for your python.exe.

enter image description here