Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug with internal command window Python Tools and Vistual Studio 2013

I just installed Python Tools with Visual Studio 2013 (Shell) and whenever I run a debug of the program, a separate window pops up for the interpreter:

enter image description here

I can however run the program using the internal interactive console:

enter image description here

However this doesn't seem to stop at any breakpoints that I set in the code. Is there a way to force the system to use the internal console for debugging instead of using a separate windowed console?

like image 274
James Mertz Avatar asked Jul 11 '13 20:07

James Mertz


3 Answers

You can hide the shell by changing Environment options in Python Tools with Visual Studio, change the default path to point pythonw.exe.

Here is the steps:

  1. TOOLS -> Python tools -> Python Environment
  2. Open Environment options, Add Environment, Enter whatever you want to name it.
  3. Copy all the options in the default Environment except change "Path:" to path of pythonw.exe. Hit OK and made the new Environment as the default environment.

Python Environment

like image 120
Ponderous Avatar answered Nov 14 '22 22:11

Ponderous


There's no way to hide the console window entirely, but all output from it should be tee'd to Output window, so you can use that if you don't like the console.

There's also a Debug Interactive window (Debug -> Windows -> Python Debug Interactive) that you may find of help, if what you want specifically is being able to stop at breakpoints and then work with variables etc in a REPL environment. Once enabled, this window will provide you a live REPL of the debugged process, and when you're stopped anywhere, you can interact with it. Like Output window, it does not suppress the regular console window, but it mirrors its output.

like image 44
Pavel Minaev Avatar answered Nov 14 '22 21:11

Pavel Minaev


Although this seems old, solution pasted elsewhere can help someone searching an answer.

I cannot comment since I don't have rep.

Here is the solution: https://stackoverflow.com/a/22486749/4809808

As far as the console window it will generally open unless you mark your app as a Windows application in project properties (this will launch pythonw.exe which doesn't include a console window).

If you right click on your project and choose Properties in the "General" tab there's a "Windows Application" checkbox below Working Directory.

like image 24
Ömer Faruk Avatar answered Nov 14 '22 20:11

Ömer Faruk