Favorite Links
Wing IDE 1.1 FAQ
Wing IDE Version 1.1.10 FAQ
This FAQ is for users of the older Wing IDE 1.1 product. Please refer to the support pages for help with Wing IDE 2.0 and the Wing IDE 1.1.10 manual for more complete installation and usage information.
Contents
- Pre-installation
- What is Wing IDE?
- What does it cost, and what do I get for that?
- What does Wing IDE run on?
- Is the IDE stable?
- What has changed recently?
- What versions of Python are supported?
- Is Wing IDE open source?
- I requested a license and received an email message with no license file?
- How do I install on Debian?
- Installation
- Configuration
- Project Manager
- Source Code Editor
- Why is the editor ignoring my configured tab size?
- Why is auto-indent / tab not doing what I want?
- Why is auto-completion not always working?
- Can I use another editor with the IDE?
- How much of emacs do you emulate?
- How do macros work?
- What about call tips?
- How do I enable structural code folding?
- Why does Wing fail to open files with spaces in their name?
- Source Code Browser
- Debugger
- How do I get to see program output and do keyboard input?
- Why do I see exceptions that I don't see when running outside of the debugger?
- Why is Wing not debugging my program exception?
- How do I set a breakpoint?
- Can I evaluate arbitrary expressions?
- Can I run an interactive Python shell?
- Can I debug CGI scripts or embedded Python code?
- Can I debug GUI applications? What about TKinter, PyGTK, PyQt, and wxPython?
- Can I debug Numeric Python code?
- Can I debug multi-threaded code?
- How do I display these "huge" values the debugger is telling me about?
- Does this work with Zope or Plone?
- Does this work with mod_python?
- Why does it hang up when I expand variables?
- How can I see my long strings?
- Why does my CGI script / externally launched program fail to start debugging?
- Why is the debugger not showing my source?
- Why is the debugger not stopping on breakpoints?
- How do I set up remote debugging?
- How do I make the profiler work under the debugger?
- How do I modify variables in the debugger?
- How do I debug code when Python is compiled --with-pydebug?
- Can I debug C, C+, Java, or other code with Wing?
- How do I avoid hanging up my X server when Wing stops during an X pointer grab?
Pre-installation
What is Wing IDE?
Wing IDE is a powerful development environment for the Python programming language. Wing IDE provides a familiar, easy-to-use integrated environment that makes reading, writing, and debugging Python a snap. Using Wing IDE and Python can be 2 to 10 times as productive as working in languages like C, C++, Java, VB, or Perl. For many users, this translates into significant savings in software development and maintenance costs.Wing IDE comes in two product levels: Wing IDE Standard is the full commercial-use product, and Wing IDE Lite is a scaled down version available for non-commercial use only. For details on the capabilities of each, see the feature list.
What does it cost and what do I get for that?
For a complete current price list, see the online store.
See also the Wing IDE purchase details page,
which describes our discounts for students and open source developers using
Wing exclusively for non-commercial purposes. Volume discounts are also
available on request.
The purchase price covers initial download, and free downloaded upgrades for the entire 1.x version series. Online and email support is also included for the life of the product. CD media is sold separately, and paid support is also available.
What does Wing IDE run on?
Wing IDE runs on Microsoft Windows, Intel Linux, and Mac OS X.
Wing IDE should run comfortably on a machine with 64MB RAM, and requires only about 10-20MB of disk space for installation. For best results, we recommend Celeron 400 or better processor speed. However, both smaller amounts of memory and slower processor speeds are likely to be quite acceptable for most users. When in doubt, try a demo license version before purchasing.
Is the IDE stable?
Yes, Wing IDE is quite stable and is in used by many registered users around
the world, on many different types of software projects. Naturally, Wing is
also used to develop itself. Take a look at what
people are saying about Wing IDE.
As with all software, minor issues do exist. Please refer to the bug list available for each release from the downloads area.
What has changed recently?
For information on changes made in each release of Wing IDE, please see the downloads area
for each release.
What versions of Python are supported?
Python 1.5.2, 2.0, 2.1, 2.2, and 2.3 are all supported. Python 1.6 is not
supported and never will be. Wing IDE on OS X only supports Python versions
2.1 and later.
Python 2.3 is supported in Wing IDE 1.1.9 and later, although there may be problems with it as long as it is in alpha or beta release stage and a patch may be necessary for Wing IDE later when 2.3 final comes out.
Python 2.4 is not supported in Wing IDE 1.1 at this time. Wing IDE 2.0.1 and later support Python 2.4 and later.
Note that Wing includes its own private copy of Python for running the IDE but the debug process still runs under your installed Python.
Is Wing IDE open source?
No, Wing IDE is a commercial product. Access to source code is included
with some licenses, but this requires a non-disclosure
agreement and you may not redistribute the code. See the licensing page for the licensing terms. See
the open source page for more information on
how this relates to open source projects.
I requested a license and received an email message with no license file?
We send the license file as an email attachment with a name that ends
with .dat and some email anti-virus filters strip the attachment
from the message before delivering it to your mailbox. Please email
sales at wingware dot com and we'll send you the
license file with another extension.
How do I install on Debian?
You can convert the Linux RPM into a Debian friendly package using the 'alien' module. Here's how:
- Download the Wing IDE RPM package.
- Install the alien-Package, which is part of the Debian Package Collection. Use apt-get, kpackage, aptitude, or other package manager to find and install it.
- Change into the directory where the Wing IDE RPM is located and issue the
following command at the cmd prompt:
alien -d wingide-#.#.#-#.i386.rpmReplace '#.#.#-#' with the appropriate Wing version and build number.
- A "wingide-#.#.#-#.deb" file can now be found in the same directory. To install the
this package issue the following command at the prompt:
dpkg -i wingide-#.#.#.-#.deb
Installation
How do I get started as fast as possible?
For the impatient, see the Quick Start Guide.The manual and the rest of this FAQ contain additional information.
Wing won't start. What now?
If you are setting the environment variable PYTHONHOME before you
start Wing IDE, then Wing IDE may fail to start up. To fix this problem, unset
PYTHONHOME and instead set the value in the Project Properties
Environment area, accessible from the Project menu.
Under a Windows terminal server, Wing may not be able to set up the environment variables it uses internally and will not start up. In this case, you can get Wing to start with the following commands:
set PYTHONOPTIMIZE=1
set PYTHONHOME=D:\Program Files\WingIDE\bin\PyCore
wing.exe
Alter PYTHONHOME according to the location at which
you've installed Wing IDE.
If this does not help, try looking at the file error-log in your
Wing IDE user profile directory (~/.wingide on Linux/Unix and
profiles/[username] inside your Wing IDE installation on Windows).
Alternatively, run console_wing.exe (on Windows)
or wing --verbose (on Linux) from the command line to
display diagnostic output. contact us for help.
Wing won't debug. What now?
It often helps to try debugging a small test such as the following:
print "test1"
print "test2"
Use the Debug command from the Run menu to cause Wing IDE to attempt to run only as far as the first line of your code. This rules out possible problems caused by specific code.
Then check through the following common problems. For information on obtaining additional information from the debug sub-system, skip ahead to the Diagnostic Output section below.
- Wing's debugger uses a TCP/IP protocol to communicate with the IDE. Make
sure that TCP/IP is installed and configured on your machine. This is sometimes
a problem on Windows 98, for example if a PCMCIA network card is ejected.
If you're running a firewall, such as Norton firewall, you may also need to configure it to accept connections to Wing IDE or to allow all connections to 127.0.0.1. Recent patches from Microsoft have in some cases altered how firewalls work so that connections to 127.0.0.1 that were previously accepted are now rejected. The Wing debugger connects from the debug process back to the IDE using a random TCP/IP port when launching from the IDE, or port 50005 (a configurable default) when using wingdbstub or the WingDBG Zope product.
- If Wing says it can't find Python or if you've got multiple versions of
Python on your system, make sure you've got your Project Properties set up to
contain a valid interpreter (see Source / Show Analysis Stats menu item to
verify that the right interpreter is being found).
- Enter any necessary PYTHONPATH for your debug process in Project
Properties if not already defined in the environment.
- Select whether or not you want a debug console to appear for your debug
process. The debug console setting is important. On Windows, not using
a debug console for a process that does keyboard input will cause the process
to stop on an exception at the point of input. On Linux, showing a
console requires xterm on Linux/Unix, which can be a problem on some
distributions. To test for this try launching Wing from the command line and
then debugging with Use Inherited Console option, which will use the shell
from which Wing was launched for the debug process I/O.
- If you set PYTHONHOME or PYTHONPATH environment variables, these
may cause the debug process to fail if they do not match the particular
Python interpreter that Wing is launching. You can either change the
interpreter used so it matches, or unset or alter these environment
values from the outside or via Project Properties from the Project
menu.
PYTHONHOME is a problem in all cases when it doesn't match the Python interpreter reported in the Source menu's Show Analysis Stats dialog.
PYTHONPATH is only a problem if it contains directories that are part of a Python installation. When this doesn't match the interpreter version, this leads to import errors because Python tries to import incompatible modules.
- On Windows, check that you don't have Hummingbird Socks Client
installed on your machine. Some versions and configurations of this
product are known to incorrectly route network packets in such a way that
slows down the Wing IDE debugger enough to make it time out during
initialization.
- All forms of the Python binary distribution (TAR, RPM, and Windows installer)
are known to have problems when a newer version of Python is
installed directly over an older one on disk.
In this case, most Python programs will appear to work fine outside of Wing IDE but will not work within the Wing IDE debugger. This occurs because the debug support code uses sockets and other functionality that is not necessarily exercised by your debug program outside of the Wing debugger.
If you try to run a debug session in Wing IDE and it fails, you may be having this problem. The following test script can be used to confirm that the problem exists in your Python installation (although it is not known whether this script shows exceptions in all cases where a corrupt Python installation is the cause of debugging problems):
import sys print 'sys.version =', sys.version print 'sys.executable =', sys.executable print 'sys.version_info =', sys.version_info import socket print 'socket =', socket print 'socket._socket =', socket._socket import select print 'select =', select import cPickle print 'cPickle =', cPickle
To solve this problem, try uninstalling Python, manually removing any remaining files, and installing again. Or install Python into a new location on disk.Once this is done, be sure to confirm that Wing is configured to use the new Python installation from the Project Properties dialog in the Project menu and that the Show Analysis Stats item in the Source menu displays the correct intepreter.
To diagnose further, set preference debug.verbose=true and
debug.persist-console=true and restart Wing IDE. Then select
Start New Console in your Project Properties. When you try again, Wing
will display a debug console with diagnostics.
Alternatively, copy wingdbstub.py out of your Wing IDE installation,
set WINGDB_SILENT environment variable = 0 (or alter kSilent inside
wingdbstub.py), choose Enable Passive Listen from the Network
Mode of Wing IDE's Run menu, and try launching the following script from
the command line:
import wingdbstub
print "test1"
print "test2"
This prints diagnostic output that may be easier to capture, especially on Windows.
Email this output to
support at wingware dot com. Include also the contents of the file
error-log in your Wing IDE user profile directory
(~/.wingide on Linux/Unix and
profiles/[username] inside your Wing IDE installation on
Windows), and also your system version, version of Wing IDE, and any
other potentially relevant details.
Debugging is very slow. What now?
Wing uses a TCP/IP sockets protocol between the debug process and the IDE. This
may be slowed down by a poor network connection or by a heavily loaded machine.
On Windows, some users have seen very long network latencies as the result of running "Hummingbird Socks Client" from hummingbird.com. When this is uninstalled, Wing's debugger will return to running at normal speed.
In general, debugging should be only about half as fast as running your program outside of the debugger. If things seem very slow, please contact support at wingware dot com.
My upgrade broke Wing. What now?
If you applied bug fix patches over your original Wing IDE installation,
you may need to uninstall Wing completely before doing an upgrade. This is
caused by the fact that some installers will fail to overwrite patched files,
resulting in random or bizarre behaviours and crashing.
Windows
To uninstall on Windows, run the Add/Remove Programs control panel to uninstall Wing IDE. Then go into the directory where Wing was located and manually remove any remaining folders and files other than the "profiles" folder, which should be retained as it contains your license file, personal preferences, and other settings files.
Linux RPM
If you installed Wing for Linux from RPM, issue the command "rpm -e wingide". Then go into /usr/lib/wingide and remove any remaining files and directories other than "floating-locks", which should be retained in multi-user installations.
Linux Tar
If you installed Wing for Linux from the tar distribution, find your Wing installation directory and run the "wing-uninstall" script located there. Once done, manually remove any remaining files and directories other than "floating-locks", which should be retained in multi-user installations.
Mac OS X
On Mac OS X, you are simply unpacking an archive to form the installation. Problems may occur if you do this over an existing installation. To avoid this, unpack to another location.
Configuration
What can I customize?
You can customize the IDE in the following ways:
- Many preferences exist for controlling behaviors of IDE subsystems
- Key equivalents can be defined for any IDE command
- The editor can run with different personalities, including a generic editor personality and an emacs-like mode
- The menubar and toolbar can be customized (currently requires editing tables in source code)
Where is the preferences file?
Wing ships with an installation-wide default preferences file and is configured
on a per-user basis with preferences that override the defaults. Your personal
preferences file is located as follows:
1) Wing IDE for Windows looks in the folder called profiles below the location where you installed Wing and then at the preferences file.
2) Wing IDE for Linux and Mac OS X looks in ~/.wingide/preferences.
On both platforms, Wing will prompt you to choose a few basic preference values if your per-user preferences file does not exist at startup. Any values defined in that file through subsequent editing will override the values found in the preferences file at the top level of your Wing IDE installation.
You can also specify a preferences file to use on the command line with the --prefs-file argument. This file will override values both in your personal and installation-wide preferences files.
Why aren't my preferences settings working?
Currently, you need to restart the IDE before preferences settings are
re-read. If there are major syntax errors in the file, the entire file may
not be read. Run console_wing.exe or 'wing --verbose' on Linux and Mac OS X to see
any errors Wing might be encountering during startup, as it tries to
read your preferences files.
How do I get my windows to fit on screen?
On Linux, the IDE doesn't correctly determine the available screen space on
all window managers. As a result, in some cases, windows will be brought up
behind window manager dressing.
You can fix this by setting specific values for the gui.work-area-rect, gui-initial-window-size, and gui.initial-window-position preferences in your preferences file. See the preferences file at the top level of the Wing installation directory for examples (commented out next to entries that set these values to None).
How do I change fonts?
To change the name or the size of the font used in menus and on buttons use
the gui.display-font-name and / or gui.display-font-size preferences. For
example, the following sets the font to size 18 Courier:
gui.display-font-name={ 'posix': 'Courier', 'win32': 'Courier' }
gui.display-font-size={ 'posix': 18, 'win32': 18 }
The default font for the text editor can be changed using the edit.display-font and the edit.display-size preferences. For example, the following sets the default editor font to size 18 Courier:
edit.display-font={ 'posix': 'Courier', 'win32': 'Courier' }
edit.display-size={ 'posix': 18, 'win32': 18 }
The editor font can also be set on a file-by-file basis through the Set Display Font/Size item on the Source menu.
Can Wing on Linux use a Browser other than Netscape?
To configure Wing running on Linux to use a web browser other than Netscape, go into
Edit / Preferences and add something like this:
gui.url-display-cmds={ \\
'http': [ "konqueror %s &", ], \\
'*': [ "konqueror %s &", ] \\
}
gui.file-display-cmds={ \\
'application/pdf': [ 'acroread %s &', 'ghostview %s &' ], \\
'*': [ "konqueror %s &", ] \\
}
The gui.url-display-cmds preference is used to determine how to display URLs selected from the Help menu. The gui.file-display-cmds preference is used to determine how to display local files selected from the Help menu or using the Open in External Viewer item in the right-click menu on the project manager.
Both are Python maps, the first one from protocol to a list of commands to try in order to display a given URL of that protocol, and the second one from mime type to a list of commands to try to display a file on disk of that type. Wing tries each command in the matching list in order until it finds one that doesn't fail to launch. The %s in the command is replaced with the URL or file name that you're opening. The '*' entry will match all URLs or files not specifically listed (the 'http' entry in the above really isn't needed; it's there just to illustrate the format).
You will need to restart Wing IDE after changing this preference, before it takes effect.
Project Manager
Do I have to use this thing?
You can run the IDE without defining projects. The advantages of using a project are that (1) it stores debug environment information (such as run arguments) and breakpoints across sessions, (2) it informs the source code browser as to the extent of your source base, so that the class browser view is complete, and (3) it often makes it easier to open and navigate around your source base.
How can I add files more rapidly?
The fastest way to build a project file is with the Add Directory Tree
command. When this is selected, you must use the file selection dialog
to click on a directory name in the left column, so that it appears
in the bar below. Then click OK.
The entire directory tree will be imported, including only files matching the wild cards in the proj.package-file-types preference and omitting any that match entries in the project.package-omit-types preference. The default preference settings will include most files.
Why can't a moved project find its files?
The IDE project files store partial relative path names to the files that
the project contains. If you want to move the project file relative to
its contained files, use Save Project As instead of simply moving the file
on disk. This will update the relative paths accordingly.
Can I share project files via revision control?
By default, Wing IDE just writes one project file. However, if you select the
Change to Shared item in the Project menu's Project Type, the IDE will save
two files, one with sharable common data, and one with user-specific data.
The file called *.wpr can be checked into revision control and shared with
other developers without revision wars. The file called *.wpu contains
your per-user configuration. See the manual for more information
on what data is stored in each file in this mode.
Source Code Editor
Why is the editor ignoring my configured tab size?
The editor will respect indentation size, given in characters, for all files. However, tab size is automatically forced to 8 characters for all Python source files that contain both tabs and spaces within indentation. If this weren't done, then your source would not always work.In general, we recommend avoiding mixed use of spaces and tabs. Spaces-only indentation is generally the least problematic. You can convert indents in your file using the Indentation Manager from the Source menu.
Why is auto-indent / tab not doing what I want?
Wing will auto-indent each time you hit enter or return and if you hit the
tab key. To turn off auto-indent at the beginning of new lines, alter the
edit.auto-indent preference. You can always still hit tab to fix a line's
indentation, even when this is turned off. Inserting a real tab character
is done by typing ctrl-tab.
The leading space added by auto-indent may contain spaces only or tabs and spaces, depending on the current file contents and options that you have configured. Choices for controlling indentation, especially when working with a heterogeneous source base and other developers, can get complicated. See the manual's Source Code Editor chapter for more information on how to configure indentation.
Note also that we strongly recommend using space-only style of indentation because this avoids many of the problems you might otherwise run into. The IDE supports conversion of files to space-only style indentation, using Indentation section of the Source menu (or Edit menu, in Wing versions before 1.1).
Why is auto-completion not always working?
First, make sure that you have given Wing IDE enough information to find
the source code it needs to analyse in order to supply you with auto-completion
options. To do this, add your files to the project file and set the Python Path
needed by your application in the Project Properties dialog.
Even with this information, Wing cannot always determine all relevant auto-completion matches. Python is a dynamically typed language, so analysing it is a difficult problem. This means the auto-completion facility may fail to recognize completion matches in some cases.
One way to get a lot more mileage out of the auto-completion facility is to use statements that assert variables as belonging to a specific class. An example is 'assert isinstance(obj, CMyClass)'. The code analysis facility will pick up on these and present you with the correct values when you type 'obj.'. An added bonus is that your code will catch errors in expected variable types in more cases.
See the browser chapter in the manual for details.
Can I use another editor with the IDE?
If you're looking to use emacs, you should be aware that Wing IDE's source
code editor can emulate emacs if you set the edit.personality preference
to 'emacs'. Sorry no vi personality yet!
It is also possible to use an external editor. When you use another editor to edit files, the IDE will detect and reload any changes made into its source code browser and source windows, usually within a few seconds of saving to disk. You can use the cache.external-check-freq, cache.unchanged-reload-policy, and cache.changed-reload-policy preferences to control when and how frequently Wing will seek to reload changed files. See the editor chapter of the manual for details.
How much of emacs do you emulate?
Most common emacs commands and key equivalents are supported, but
lisp-based extensions cannot be used with Wing IDE. See the manual for a
complete list of the defined commands and key bindings. Email us if you
have favorite emacs features that are missing.
How do macros work?
Keyboard/command macros can be defined from the Edit menu. Once you start
a macro recording session, an editor will capture all keystrokes and commands
that it receives until the macro recording is stopped. Macros can only
be recorded within a single editor window but can be played in any window.
Details on using this feature are found in the manual.
What about call tips?
Autocompletion is supported: Wing will try to suggestion completion matches as
you type within Python source code windows. Call tips, that display the call
signature of a function during parameter entry, are not yet available.
How do I enable structural code folding?
In some versions of Wing IDE, code folding is off by default. To turn it
on, use the Code Folding section of the Project menu. This selection is
saved across sessions in your project file. Note that even when enabled,
folding is only available for some types of source files, including
Python, C/C++, Java, Javascript, HTML, XML, Eiffel, Lisp, and Ruby.
Why does Wing fail to open files with spaces in their name?
On Windows: When using Windows File Types or Open With to cause Python
files to be opened with Wing, some versions of Windows set up the wrong command
line for opening the file. You can fix this using regedt32.exe, regedit.exe, or
similar tool to edit the following registry location:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Applications\wing.exe\shell\open\command
The problem is that the association stored there is missing quotes around
the %1 argument. It should instead read as follows:
"C:\Program Files\Wing IDE\bin\wing.exe" "%1" %*
On Linux: KDE's Konqueror has the same problem that file names passed on the command line to applications bound to a file type are not enclosed with quotes, so the command line is not parsed correctly. We do not currently have a work-around for this problem.
Source Code Browser
Why do classes appear slowly when I first open a project?
The first time you set up a project file, Wing analyses all source files for the code browser and autocompletion facilities. This information is stored to disk in a cache within ~/.wingide (on Linux and Mac OS X) or in WINGHOME/profiles (on Windows), and with large projects even reading this cache may take a while when Wing is first started. This process happens in the background after launch and takes 7-15 seconds per 100,000 lines of code on a Celeron 400 processor. During this time, the browser's class-oriented views will display only the source constructs from files of which analysis information has been obtained already.
Debugger
How do I get to see program output and do keyboard input?
By default, Wing does not show a new console for interacting with your debug process. This is appropriate for GUI apps but not if you are running code that prints values and/or expects keyboard input.To enable console I/O for your debug process, bring up the Project Properties dialog from the Project menu and select Start New Console for the Debug Console value.
Once your program runs to completion, the console is destroyed. If you need to see output at program exit, just set a breakpoint on the last line of your code.
You can also force Wing to retain the I/O console for each debug session until you press enter in the console window. This is done by setting preference debug.persist-console to true and restarting Wing. This approach is not as convenient in most cases, since it can accumulate many debug consoles and each debug process is not fully terminated until the console is closed.
Why do I see exceptions that
I don't see when running outside of the debugger?
Most C/C++ extension modules, including some in the Python standard library,
catch and handle exceptions that are raised within Python code.
Any time this happens, Wing will report those exceptions at runtime as unhandled exceptions. This is because it is impossible to determine whether the exception is actually going to be unhandled.
When this occurs, select the "Don't show me this exception location again" checkbox in the Error List dialog that reports the exception and continue running your application.
Wing stores your exception ignore values in the project file on dist, and will redisplay these exceptions in future work sessions.
To clear your list of ignored exceptions, use the Clear Ignored Exceptions item in the Run menu.
Why is Wing not debugging my
program exception?
This is related to the previous question.
By default, Wing only stops on exceptions it thinks will be unhandled. If your code runs within a catch-all top-level try/except clause, Wing will not report any exceptions encountered in your debug process, except if that exception leads the debug process to exit (and then only after the fact).
This can be confusing if you are running without a debug console (see above) because you will not see any exception information that your catch-all handler might otherwise print.
To get Wing to stop, you can set Exception Mode from the Run menu to Always Stop (or set preference debug.exception-mode='always'). However, this can lead to reporting of many other exceptions that happen internally during normal operation. An alternative is to recode your app to make the top-level catch-all handler optional so you can avoid it during debugging under Wing IDE.
How do I set a breakpoint?
Break points can be set by clicking on the breakpoint margin to the left of source
code, or by placing the edit caret and using the Breakpoints menu or toolbar.
See the manual for key modifiers that can be used while clicking on the break point
margin: For example, Ctrl-click places a temporarily ignored breakpoint, and
ctrl-shift-click places a conditional breakpoint.
Can I evaluate arbitrary expressions?
Yes, just open the Expression Evaluator from the Windows Menu. But note
that this evaluates in the context of the currently selected debug frame, and thus
is disabled if you are not running a debug session, or if the debug program is
free-running and not stopped at a breakpoint or exception.
Can I run an interactive Python shell?
Yes, there are two interactive shell tools available: The Interactive Shell
and Debug Probe items in the Windows menu can be used to display these.
The Interactive Shell runs commands in a separate isolated Python process,
using the same version of Python you have selected for your debug program.
This tool can be used at any time to conveniently try out Python fragments.
The Debug Probe acts like the Expression Evaluator in that it executes commands in the
context of the currently selected debug frame if a debug program is present
and stopped at a breakpoint, exception, or pause location. It is disabled when
a debug program is free-running.
Can I debug CGI scripts or embedded Python code?
Yes. The IDE's debugger consists of networked client and server, and it
supports attachment to the running IDE from an externally launched process.
The Wing debugger machinery only requires access to a TCP/IP network
connection and that source files are stored on disk in a way that they are
accessible both to the IDE and to the debug process (for example, via Samba,
NFS, or other file sharing).
Some debug scenarios can be a bit tricky to set up initially. See the manual for
details on remote and embedded debugging.
Can I debug GUI applications? What about
TKinter, PyGTK, PyQt, and wxPython?
Wing IDE contains special debug support for PyGTK, TKinter, and wxPython applications. This code ensures that a
free-running debug process remains responsive to pause requests or when
breakpoints are set or altered.
Other GUI environments (such as PyQt) also work, but there is no code inside the debugger to ensure that the debug process remains responsive to the debugger while free-running. This means that the debugger may time out if you try to add breakpoints or execute certain other debugger operations while the GUI application is free-running and no Python code is being reached.
This problem occurs only when no Python code is reached at all, so it is often possible to work around it by causing Python code to be called in your program. For example, for PyQt, you can add the following after your QApplication has been created and before you call exec_loop():
# Hack to burn some Python bytecode periodically so Wing's
# debugger can remain responsive while free-running
timer = QTimer()
def donothing(*args):
for i in range(0, 100):
x = i
timer.connect(timer, SIGNAL("timeout()", donothing)
timer.start(500, 0)
An alternative is to write debug-level support for your environment. In Wing
version 1.1 and later, an extensibility API is provided to allow users to
support additional environments without these limitations. This is described
in the Debugger chapter of the manual.
Can I debug Numeric Python code?
Numeric Python works with the debugger but you must use the Expression
Evaluator or Debug Probe to view portions of large Numeric Python arrays
because the main debugger variable view will refuse to transfer large values.
In fact, even the Expression Evaluator and Debug Probe will refuse to
view too large of a slice of an array at a time. If you run into this problem,
see the next item below for more information on dealing with this.
Can I debug multi-threaded code?
Wing IDE can currently only debug one thread of a multi-threaded application
at a time.
In some cases, Wing's ability to debug one thread at a time can still be useful. The thread that you debug can be any of many, and you can start debugging at any point in the execution of your program.
To do this, follow the instructions in the Debugger chapter of the manual to set up external launch debugging. You will want to make sure wingdbstub is imported in the thread that you wish to debug.
If you are only importing wingdbstub, you won't be able to debug any other thread until the debug process is exited and restarted. Finer control over starting and stopping debugging is possible using the Debugger API. The best way to get started with that is to look at how it is used in the WingDBG Product for Zope. If you plan to use the debugger API, you must use Wing IDE 1.1.10.
If you need help setting up debugging of your multi-threaded application, please contact us at support at wingware dot com.
How do I display these "huge" values the
debugger is telling me about?
You can alter the size limit on large items the debugger will display with the
debug.huge-list-threshold preference. If you do this, you may also need to
change the debugger's patience in waiting for these large lists to transfer
with the debug.network-timeout preference. This value is purposely set low now
to prevent lengthy hanging of the IDE when the debug program crashes. See the
manual for details on
altering these preferences.
One way of viewing these values without increasing timeout values is to enter expression in the Expression Evaluator or Debug Probe windows, accessible from the Windows menu. For example, for a large array, you can enter a value like a[2:5][7] to arrive at a manageable value size.
Does this work with Zope or Plone?
Yes, you can use Wing with an existing Zope installation using the debugger product
for Zope. This also works for Plone. For more information, see Using Wing with Zope and Using Wing with Plone.
Does this work with mod_python?
Yes, if you are using Wing IDE 1.1.5 or later. See the mod_python + Wing HOW-TO
for details.
Why does it hang up when I expand variables?
Depending on how you are expanding variables, you may be transferring a large
amount of data from the debug server. We recommend some caution when using
Expand More to great depths. Very long lists or dictionaries may also take
some time to appear. The maximum displayable length of all values are
controlled with the debug.huge-list-threshold and debug.huge-string-threshold
preferences. See the manual for details on
altering these preferences.
How can I see my long strings?
Long strings are truncated by default when they are sent to the IDE from
the debug process. To expand a truncated string, click on it and view its
full form in the Textual View area at the bottom of the debugger window.
If you are working from a zoom-ed out view, right click on the string instead
and use the Display in Textual View item in the popup menu that appears.
The maximum displayable length of strings is controlled with the debug.huge-string-threshold preference. See the manual for details on altering these preferences.
Why does my CGI script / externally launched program fail
to start debugging?
The debugger stub used for debugging programs launched outside of the IDE will
automatically run without debug if it fails to attach to the IDE. This is an
important feature so that CGIs and other programs continue to function when
the IDE isn't running. If this happens, check that your client and server port
and host names are configured correctly so that they match. See the manual for
details on how this is done.
You may also want to set kSilent to 0, or set kLogFile in wingdbstub.py in order to see whether an exception is being raised by the debug machinery.
Why is the debugger not showing my source?
The most common cause of failure to bring up source windows while stopping or
stepping through code is a mismatch between the file name that is stored in
the *.pyc file and the actual location of the *.py source file.
This is most commonly caused by (1) not saving before you run in the debugger, (2) moving around the *.pyc file after they are created, or (3) using compileall.py to create *.pyc files from source.
The easiest way to solve problem with *.pyc files is to remove all your *.pyc files before debugging, for example with the following command on Linux and Mac OS X:
rm -f `find . -name \*.pyc`Important: Don't do this system-wide but only in directories that contain the corresponding *.py source files for all *.pyc files. Some binary installations of Python tools, including Wing IDE, includ only the *.pyc file and no *.py source code. In those cases, removing the *.pyc will result in ImportError when Python cannot find the *.pyc and cannot regenerate it from source code!
Another common problem is running the debug process with a partial or relative path name and using os.chdir() during execution. This can confuse the debugger in certain cases, as described in the manual.
Less common causes of this problem are (1) running Python with the -O optimization option, (2) overriding the Python __import__ routine, (3) adding breakpoints after you've started debugging an application that spends much of its time in C/C++ or other non-Python code, and (4) on win32, using symbolic links to directories that contain you source code files (Posix platforms handle symbolic links just fine).
For more information, see the Limitations section of the Wing IDE manual's Debugger chapter.
Why is the debugger not stopping on breakpoints?
Failure to stop on breakpoints is caused by the same factors that cause failure
to locate source code during debugging. See the
above section.
How do I set up remote debugging?
To set up remote debugging, please refer to the manual to make sure you go through
the necessary configuration steps properly.
The system assumes that both client and server have access to the same Python code. Although the debug program doesn't need to have the source files (*.pyc files will work), the server-side files must match the client-side source. If this is not the case, the debugger will either fail to stop at breakpoints or stop at the wrong place, and stepping through the code will be confusing at best.
Since there currently is no mechanism in the IDE for transferring code, you need to use ftp or NFS or some other file transfer mechanism to keep the remote files up to date as you edit them in the IDE. You may also need to alter the debug.location-map preference, as described in the user manual.
How do I make the profiler work under the debugger?
Be warned that running the profiler under the debugger may yield inaccurate results
since the debugger adds overhead that isn't always uniform across your code base.
If you still want to do this, read on.
The Python profiler makes some assumptions about how it is started that conflict with the way the Wing debugger works. Because the debugger can start debugging on the fly in the context of already-running code, it confuses the profiler into using the wrong top-level scope for its activities.
This means that a file like the following will not work:
import profile
def main():
a = 1
profile.run("main()", "profile_tmp")
The profiler will raise an AttributeError on main because
it is looking for it in the top-level file, which is not your code
when running under Wing.The way to solve this problem is to explicitely import and run the function you wish to profile, as follows:
import profile
def main():
a = 1
profile.run("import mymodule; mymodule.main()", "profile_tmp")
How do I modify variables in the debugger?
You can modify variables in the current stack frame via the interactive debug probe. The probe is a version of the interactive shell that executes in the context of the current stack frame. It it you can execute just about any Python statement, including an assignment statement; e.g.a = 1
or self.attrib = "hello".
The interactive debug probe is not available in Wing IDE Lite.
How do I debug code when
Python is compiled --with-pydebug?
The dbgtracer module shipped with Wing IDE will not run under a copy of
Python that is compiled with the --with-pydebug option because the
InitModule symbol is purposely defined differently when Python is
compiled with this option. See the end of Include/modsupport.h in your
Python sources for details.
The only solution is to recompile Wing's dbgtracer extension module against Python sources configured with the --with-pydebug option. Recompiling the debug server is described in the Debugger chapter of the manual.
Note that running the IDE with a copy of Python compiled this way requires that you run it with the --verbose option (Posix) or use console_wing.exe (Windows) so you can respond to the "Print left references? [ny]" queries that will appear in the console window from which you launched Wing IDE, and in the console window for the debug process.
Can I debug C, C++, Java,
or other code with Wing?
The Wing debugger is for Python code only at this point and doesn't
itself handle stepping into C or C++. However, you can set up VC++ or
the gdb debugger in conjunction with the Wing IDE debugger to debug
errors in either C or Python at the same time.
This is done by running your Python code under the VC++ or gdb debugger as you would anyway for C/C++ debugging, while using the Wing debugger at the same time by importing wingdbstub into your code.
To debug the C/C++ code you need to be running with a copy of Python compiled from sources with debug symbols. To configure wingdbstub, see the Debugger chapter of the Wing IDE manual.
The Wing Tips appendix in the manual has some additional info on setting up gdb and the Wing debugger together (gdb can be a pain because it doesn't handle shared libs well; this section helps work around the problems). VC++ doesn't have these issues so is generally easier to use in this way.
How do I avoid hanging up my X
server when Wing stops during an X pointer grab?
Wing does not attempt to break XGrabPointer or XGrabKey and similar resource
grabs when your debug process pauses. This means that X may be unresponsive to
the keyboard or mouse or both in some debugging cases.
Here are some tips for working around this problem:
- Some toolkits have an option to disable resource grabs specifically to
avoid this problem during debugging. For example, PyQt has a command line
option '-nograb' that prevents it from ever grabbing the keyboard or pointer.
Adding this to the debug process command line solves the problem.
If you are writing your own calls to XGrab* or similar functions, consider adding a mode where these calls are skipped.
One trick that often helps is to move processing from the callback where the pointer or keyboard grab is still in effect into an asyncronous call-back that occurs at idle time. For example, under GTK use gtk_idle_add() and in wxPython try a wxTimer.
- Under XFree 4.2 and later, there is a configuration option you can set
so that Ctrl-Alt-Keypad-/ will break through any active pointer and keyboard
grabs:
# Let user break server grabs with ctrl-alt-keypad-/ Option "AllowDeactivateGrabs" "true"This goes into your XF86Config file in the "ServerOptions" section. Check 'man XF86Config' for the search path that X uses to find the config file and find the one that's used on your system. For example, on Mandrake 8.2 the config file is /etc/X11/XF86Config-4.You will need to restart your X server for the config changes to take effect (for example, log out and back in again). Be aware that mucking with your XF86Config file can cause X to fail to start up. If this happens, you will need to fix it in text mode. If you get into this situation, typing 'startx' after each edit is a good way to check whether your fix works.
If you need to check what version of XFree you're running, typing 'rpm -q XFree86' usually works or 'man XFree86' shows the version number at the very end of the man page.
- On Linux, if all else fails, you can use Ctrl-Alt-F1 through Ctrl-Alt-F6
on most distributions to get at six text-only virtual console. From there you
can 'ps' to find the debug process and kill it with 'kill -TERM' or 'kill -9'
if necessary. This will unlock your X windows display, which you can return
to with Ctrl-Alt-F7.
- Displaying your debug process to another screen avoids tying up Wing in
this way. Most servers will unlock the screen once you kill the debug process
from Wing.
