Home » Support » Index of All Documentation » How-Tos » How-Tos for Other Libraries »

Using Wing with Twisted

Personal+

Wing is a Python IDE that can be used to develop, test, and debug Python code written for Twisted. Two versions of Wing are available: Wing Pro is the full-featured Python IDE for professional programmers, and Wing Personal is a free alternative with reduced feature set.

If you do not already have Wing installed, download it now.

To get started using Wing, refer to the tutorial in the Help menu in Wing or the Quickstart Guide.

Installing Twisted

The Twisted website provides complete instructions for installing and using Twisted.

Debugging in Wing

To debug Twisted code launched from within Wing, create a file with the following contents and set it as your main debug file by adding it to your project and then using the Set Main Debug File item in the Debug menu:

from twisted.scripts.twistd import run
import os
try:
    os.unlink('twistd.pid')
except OSError:
    pass
run()

Then go into the File Properties for this file (by right clicking on it) and set Run Arguments to something like:

-n -y name.tac

The -n option tells Twisted not to daemonize, which would cause the debugger to fail because sub-processes are not automatically debugged. The -y option serves to point Twisted at your .tac file (replace name.tac with the correct name of your file instead).

You can also launch Twisted code from outside of Wing using the module wingdbstub.py that comes with Wing. This is described in Debugging Externally Launched Code in the manual.

Related Documents

Wing provides many other options and tools. For more information:

Using Wing with Twisted