6

I am brand new to VSCode with Python. Is it possible to write to the tab DEBUG CONSOLE (only) from Python code? I have Googled but found nothing on this.

The debugger does this internally, e.g. on a breakpoint set to Log Message. For the moment, if I use print() that does go to DEBUG CONSOLE, but it also goes to TERMINAL tab, which I'd rather it did not. The launch.json has "console": "integratedTerminal" if that is relevant.

1
  • If you are interested in using this setting globally (it is per-debug-configuration currently), you may want to upvote this feature request: github.com/microsoft/vscode-python/issues/18353 Commented Jan 25, 2022 at 17:48

1 Answer 1

6

You can set "console": "internalConsole" to have output go to the debug console.

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

4 Comments

Thank you. Yes, this causes output only to DEBUG CONSOLE! It wasn't quite what I wanted --- I wanted a call from Python code which achieved that regardless of "console" setting, I might want integratedTerminal for elsewhere in code. I don't understand from the docs why "integratedTerminal" causes output to both DEBUG CONSOLE and TERMINAL tabs, but there you are. Unless you respond further, I will mark yours as the Accepted Solution soon, thanks!
@JonBrave what you're after isn't currently supported. You can file a feature request at github.com/microsoft/ptvsd if you would like that feature.
Ah, that would explain why it currently doesn't work that way! Thanks. I'll mark this as the effective solution.
That option does or might have this issue re input stackoverflow.com/questions/73993577/…

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.