How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)?

GollyJer

In PTVS the default behavior is for the program to print to the Python console window and the Visual Studio Debug Output window.

Realizing that it won't be able to accept user input, how do I suppress the Python console window?

GollyJer

This was more difficult to figure out than expected, but as usual, simple once you know.

The quick answer.
In the Solution Explorer, right click on the project and select Properties. On the General tab check the box next to Windows Application.

Windows Application Checkbox

Then save and close the properties window. Done!


Other details from the discussion of an issue posted in 2012 on the PTVS codeplex site.
Python shell appears in addition to output window of IDE

The typical way to hide the Python console window is to set the Windows Application property (in the project properties window), which will then run pythonw.exe instead of python.exe. This is only really an option if you don't provide any input while your program is running - the output window in VS is not a console and does not support typing into your program. Also, this option is per-project, so you'll have to set it for each project. (It also seems to not be working in our latest builds, so we'll fix that asap...)

The other option is to stop printing output in Visual Studio and only use the console window. If you are suffering performance issues, this is more likely to solve the problem. To do this, open Tools->Options->Python Tools->Advanced and deselect "Tee program output to Debug Output window". You will probably also want to select "Wait for input when process exits normally" while you are here. Now all output will go to the Python console (you can right-click the title bar and choose Properties to make it bigger), which will be faster.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Console Window Appears while debugging Python code using PTVS in Visual Studio

From Dev

How do I suppress console/cmd error messages in python

From Dev

Python 3.4 Visual Studio PTVS Incorrect Intellisense

From Dev

Is there any way to debug Python code embedded in C# with Visual Studio and PTVS?

From Java

Visual Studio Code - Python debugging - Step into the code of external functions when executing

From Dev

Visual Studio Code - Python debugging - Step into the code of external functions when executing

From Dev

Cannot start Tkinter window in Visual Studio with Python Tools

From Dev

How can I debug Python 3 code in Visual Studio Code?

From Dev

When Debugging in Visual Studio, how do I view the function call hierarchy/stack in the IDE?

From Dev

How do I use visual studio debugging shortcuts on a Mac?

From Dev

Is there a way to open the Console window on Node.js tools for Visual Studio?

From Dev

How do I install Visual Studio Code?

From Dev

How can I use the Python Tools for Visual Studio mixed mode debugger with Enthought Canopy Distribution?

From Dev

How do I suppress the terminal window when I launch a bash script from Spotlight?

From Dev

How do I install this console library? visual studio c++

From Dev

Visual Studio delays when Start Without Debugging on a console application

From Dev

Visual studio Code with python

From Dev

Console window exits when debugging

From Java

How do I re-open the Visual Studio Immediate Window?

From Dev

Visual Studio extension window not showing up when debugging

From Java

How do I collapse sections of code in Visual Studio Code for Windows?

From Dev

Python Tools for Visual Studio - generate exe

From Dev

Python Tools for Visual Studio Inline Graphics

From Dev

Refactoring Actions are Disabled - Python Tools for Visual Studio

From Dev

How do I run code when a Python class is evaluated

From Dev

How do I run code when a Python class is evaluated

From Dev

Microsoft Visual Studio Code pop out a console window

From Dev

How can I edit my code while debugging using Visual Studio?

From Dev

How do I pass args while debugging a node.js project in Visual Studio 2017?

Related Related

  1. 1

    Console Window Appears while debugging Python code using PTVS in Visual Studio

  2. 2

    How do I suppress console/cmd error messages in python

  3. 3

    Python 3.4 Visual Studio PTVS Incorrect Intellisense

  4. 4

    Is there any way to debug Python code embedded in C# with Visual Studio and PTVS?

  5. 5

    Visual Studio Code - Python debugging - Step into the code of external functions when executing

  6. 6

    Visual Studio Code - Python debugging - Step into the code of external functions when executing

  7. 7

    Cannot start Tkinter window in Visual Studio with Python Tools

  8. 8

    How can I debug Python 3 code in Visual Studio Code?

  9. 9

    When Debugging in Visual Studio, how do I view the function call hierarchy/stack in the IDE?

  10. 10

    How do I use visual studio debugging shortcuts on a Mac?

  11. 11

    Is there a way to open the Console window on Node.js tools for Visual Studio?

  12. 12

    How do I install Visual Studio Code?

  13. 13

    How can I use the Python Tools for Visual Studio mixed mode debugger with Enthought Canopy Distribution?

  14. 14

    How do I suppress the terminal window when I launch a bash script from Spotlight?

  15. 15

    How do I install this console library? visual studio c++

  16. 16

    Visual Studio delays when Start Without Debugging on a console application

  17. 17

    Visual studio Code with python

  18. 18

    Console window exits when debugging

  19. 19

    How do I re-open the Visual Studio Immediate Window?

  20. 20

    Visual Studio extension window not showing up when debugging

  21. 21

    How do I collapse sections of code in Visual Studio Code for Windows?

  22. 22

    Python Tools for Visual Studio - generate exe

  23. 23

    Python Tools for Visual Studio Inline Graphics

  24. 24

    Refactoring Actions are Disabled - Python Tools for Visual Studio

  25. 25

    How do I run code when a Python class is evaluated

  26. 26

    How do I run code when a Python class is evaluated

  27. 27

    Microsoft Visual Studio Code pop out a console window

  28. 28

    How can I edit my code while debugging using Visual Studio?

  29. 29

    How do I pass args while debugging a node.js project in Visual Studio 2017?

HotTag

Archive