Debugging Extension Scripts

Index of All Documentation » Wing Pro Reference Manual » Scripting and Extending Wing »


Wing can debug extension scripts that you develop for the IDE. This is done by setting up a new project from Wing's Project menu. Select the default project type and for Python Executable select Custom and enter the full path to the python executable that Wing uses to run itself. On OS X and Linux this will be:

WINGHOME/bin/runtime-python2.7/bin/python

On Windows use this is instead:

WINGHOME\bin\runtime-python2.7\bin\python.exe

In the above WINGHOME must be replaced by the location at which Wing is installed (or on OS X the full path to the Contents/Resources folder within the WingIDE.app application bundle directory, for example /Applications/WingIDE.app/Contents/Resources).

Press OK in the New Project dialog to create the project, then select Add Existing Directory from the Project menu and add Wing's installation directory (same as WINGHOME you used in the above, or on OS X you can instead add just the Contents/Resources folder within the WingIDE.app directory).

Next navigate to bin/wing.py in the Project tool, right click on it, and select Set As Main Debug File.

Finally, on OS X only you will need to open Project Properties from the Project menu, select Add To inherited environment under Environment and enter the following text:

WINGHOME=/Applications/WingIDE.app/Contents/Resources
LIBDIRS=${WINGHOME}/bin/runtime-python2.7/lib:${WINGHOME}/bin/runtime-qt5.5/lib:${WINGHOME}/bin/runtime-sip-py2.7/lib:${WINGHOME}/bin/runtime-pyqt5.5-py2.7/lib:${WINGHOME}/bin/runtime-scintillaedit-qt5/lib
DYLD_LIBRARY_PATH=${LIBDIRS}
DYLD_FRAMEWORK_PATH=${LIBDIRS}

If you didn't install Wing in the /Applications folder then you will need to edit the text to specify the correct installation location.

Then save your project to disk.

You should now be able to select Start/Continue to start up a copy of Wing in the debugger. Any breakpoints set in scripts that you have added in the scripts directory will be reached as you work with the debugged copy of Wing. You will see and can navigate the entire stack, but Wing will not be able to show files for most of Wing's code. If you need to see the source code of Wing itself, you will have to obtain the source code as described in the following section.