Debugger Quick Start
Overview of Capabilities
Wing can be used to debug all sorts of Python code, including desktop applications, web applications, numeric and scientific applications, games, and many others. Code that Wing debugs may be launched from the IDE, or started outside of the IDE. It may be running stand-alone on the local host or launched from a web server or web framework. Wing Pro can also debug code running on a remote host, virtual machine or device, in an application that uses Python as a scripting language, or inside a container like those provided by Docker. The debugger can work with asynchronous and multi-threaded code and (in Wing Pro) multiple concurrent processes.
Wing Pro includes support for many different packages and frameworks, including wxPython, Tkinter, PyQt, PyGObject, matplotlib, Jupyter pygame, Django, Flask, Pyramid, mod_wsgi, Plone and many others. Wing can also work with code running in an embedded Python interpreter in the context of a larger application such as Blender, Maya, Nuke, and Source Filmmaker.
While Wing is capable of debugging Python code in many development scenarios, this Quick Start guide focuses on the case where you are working with locally stored code that is launched from the IDE. If you need to launch code from outside of the IDE, on a remote host, virtual machine or device, or on a container like those supported by Docker, please see this overview.
Getting Started
Before debugging, you will need to install Python on your system if you have not already done so. Python is available from python.org or you can use a distribution like Anaconda.
To start debugging some Python code, open up the file in the editor and then select Start / Continue from the Debug menu. This will run to the first breakpoint, unhandled exception, or until the debug program completes. Select Step Into instead to run to the first line of code. For details see Starting Debug.
To set breakpoints, just click on the left-most margin next to the source code in the editor. In Wing Pro, conditional and ignore-counted breakpoints are also available from the Breakpoint Options group in the Debug menu, or by right-clicking on the breakpoints margin. For details, see Setting Breakpoints.
You can step through code with the items in the Debug menu or from the toolbar. For details see Flow Control.
To view debug data you can hover your mouse over a value in the editor or use the Stack Data tool from the Tools menu to inspect locals and globals. In Wing Pro, you can also interact with the current debug stack frame and try out new code in the Debug Console from the Tools menu, or press Shift-Space to view all visible values in the editor. For details see Viewing Debug Data and Interactive Debug Console.
Use the Debug I/O tool to view your program's output, or to enter values for input to the program you are debugging. If your program depends on characteristics of the Windows Console or a particular Linux/Unix shell, see External I/O Consoles for more information.
In some cases, you may need to specify a Python Executable, Python Path or other environment using Project Properties in the Project menu. Setting the Python Executable is only necessary if Wing cannot find Python on your system or if you have more than one version of Python installed. Command line arguments to use when debugging a file may be set in File Properties for the file. See Debug Environment for more options.
There are many other capabilities available in the debugger, as described in the rest of this chapter and Advanced Debugging Topics.