2

Can I redirect stderr when running or debugging python code in VS Code? Sometimes I don't want to see all the messages that imported modules spit out. Very often they aren't helpful. I'd like to be able to send stderr to /dev/null or another file sometimes, but not always. I can run my python program that way directly in the terminal, but I want to do this when debugging so I can see my output without it scrolling quickly by. Thank you.

1 Answer 1

1

In the debugger press the configuration file down arrow. It probably says current program. Press add configuration. Then towards the bottom of the json file add this:

 "args": ["2>/dev/null"] 

Remember to put a comma at the end of the previous line. Then run the debugger.

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

1 Comment

Since VS Code doesn't run the command in a shell, this will not work. It will simply be passed to the program you're running as an argument.

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.