0

When run a Python file, by clicking this,

I will receive the location of the file before I get the answer:

So can someone tell me how to delete it or make it look better?

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
danghwi05
  • 11
  • 1
  • what is the purpose of copying the same text in the question? It does not help you to an answer, more likely it will be slow you down, don't tag it with the wrong subjects – rioV8 Jan 14 '23 at 14:55
  • Does this answer your question? [How to hide file paths when running Python scripts in VS Code?](https://stackoverflow.com/questions/61176552/how-to-hide-file-paths-when-running-python-scripts-in-vs-code) – mkrieger1 Jan 16 '23 at 01:59

1 Answers1

1

You can use the following two ways:

  1. Use debug mode, and change "console" to "internalConsole". Your launch.json will look like:

     {
         "version": "0.2.0",
         "configurations": [
             {
                 "name": "Python",
                 "type": "python",
                 "request": "launch",
                 "program": "${workspaceFolder}/path/to/your_script.py",
                 "console": "internalConsole"
             }
         ]
     }
    
  2. You can use code-runner extension if you do not want to use debug everytime. Then add the following code to your settings.json:

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

    In this way, you can click the Run Code button in your first picture, and the path will not be displayed each time you run file, and the last run result will be cleared automatically each time you run if you use code-runner extension.

mkrieger1
  • 19,194
  • 5
  • 54
  • 65
MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13