4

In visual studio code I want run simple python code (using the code runner extension) and it gives me info about runtime and where the file is. I don't want that, can I cut it out and only have the output?

Image

8
  • Are you executing your python from the Run menu in Visual Studio Code? If so, then the system info you are seeing -- most likely -- comes from bash or powershell (depending on which one you are using). That behavior would be independent of Visual Studio Code. You should see the same system info when you invoke either of those terminals outside of Visual Studio Code. Commented Feb 21, 2021 at 19:47
  • 1
    @jim that's not bash or powershell - that's the native vscode output Commented Feb 21, 2021 at 20:12
  • change output tag to terminal tag. In terminal, run python -u "hello world.py" Commented Feb 21, 2021 at 20:21
  • 1
    @jim Just to clarify, that's actually not the native/built-in VS Code output, that is from the Code Runner extension. The native VS Code output for Python does not look like that (does not have [Running] and [Done] tags). Commented Feb 22, 2021 at 0:00
  • Does this answer your question? How to hide file paths when running Python scripts in VS Code? Commented Feb 22, 2021 at 0:01

1 Answer 1

3

Since you use the "Code Runner" extension, we can set it:

  1. We can add the following settings in "settings.json":

"code-runner.showExecutionMessage": false,

  1. or find the "showExecutionMessage" option in "settings", uncheck it:

    enter image description here

Run:

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Will the above still allow if the python code is asking for user input?
@Jarhead1775 -This is the "output" terminal, so it only supports the output of the result, the input terminal needs to be in "Terminal".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.