pythonvisual-studio-codevscode-python

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


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.


Solution

  • 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.