How to suppress console window while debugging python code in Python Tools for Visual Studio (PTVS)?

In PTVS, the default behavior is that the program will print in the Python console window and in the Visual Studio debug output window.

Realizing that he will not be able to accept user input, how do I suppress the Python console window?

+6
source share
2 answers

It was harder to understand than expected, but as usual simple as soon as you know.

Quick response.
In Solution Explorer, right-click on the project and select Properties. On the General tab, select the check box next to Windows Application.

Windows Application Checkbox

Then save and close the properties window. Done!


Other details are from a discussion of the issue published in 2012 on the PTVS codeplex website.
Python shell appears in addition to the IDE exit window

A typical way to hide the Python console window is to set the Windows Application Property (in the project properties window), which will then launch pythonw.exe instead of python.exe. This is really an option if you do not enter any input while your program is running - the output window in VS is not a console and does not support input to your program. In addition, this option is intended for each project, so you will have to set it for each project. (It also does not seem to work in our latest builds, so we will fix this as soon as possible ...)

Another option is to stop printing output in Visual Studio and just use the console window. If you are experiencing performance issues, this is likely to solve the problem. To do this, open Tools-> Options-> Python Tools-> Advanced and deselect "Tee program output to debug output window". You probably also want to select “Wait for input when the process completes normally” while you are here. Now all the output goes to the Python console (you can right-click and select “Properties” to make it bigger), which will be faster.

+12
source

Use the Python interactive window (CTRL-ALT-F8 or the debug menu). You will have code output on the python interactive shell (where you can explicitly interact). The win terminal will no longer appear.

0
source

Source: https://habr.com/ru/post/984364/


All Articles