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

5.3. Using Wing IDE with Blender

Wing IDE is an integrated development environment for the Python programming language. Wing can be used to speed up the process of writing and debugging Python code that is written for Blender, an open source 3D content creation system.

Introduction

Blender's loads Python scripts in a way that makes them difficult to debug in a Python debugger. The following stub file can be used to work around these problems:

import os
import sys

# MODIFY THESE:
winghome = r'c:\Program Files\Wing IDE 2.1'
scriptfile = r'c:\src\test\blender.py'

os.environ['WINGHOME'] = winghome
if winghome not in sys.path:
    sys.path.append(winghome)
#os.environ['WINGDB_LOGFILE'] = r'c:\src\blender-debug.log'
import wingdbstub
wingdbstub.debugger.StartDebug()

def runfile(filename):
    execfile(filename)
runfile(scriptfile)

To use this script:

  • Modify winghome & scriptfile definitions where indicated to the wing installation directory and the script you want to debug, respectively. When in doubt, the location to use for winghome is given as the Install Directory in your Wing IDE About box (accessed from Help menu).
  • Run blender
  • Click on upper left icon and select text editor
  • Click on icon to right of "File" to display text editor pane
  • Select File -> Open from the bottom menu bar and select this file to open

Once the above is done you can debug your script by executing this blenderstub file in blender. This is done using File -> Run Python Script from the bottom menu or by the Alt-P key, though Alt-P seems to be sensitive to how the focus is set.

Note that you will need to turn on passive listening for debug connections in Wing, which is most easily done by clicking on the bug icon in the lower left of the main window and selecting Enable Passive Listen in the popup menu that appears.

Related Documents

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

« 5.2. Using Wing IDE with pygameTable of Contents5.4. Using Wing IDE with scons »