Stepping through Nuke python code using Wing IDE: Oooooh, does it work?

Written by Markus Lofstrom on .

Troubleshooting python scripts in Nuke can be painful, especially when you are used to working in Visual Studio using breakpoints and stepping through code. So I was excited when Wing IDE announced that their latest version (4.1.8) supported debugging in Nuke. I downloaded the free trial and gave it a shot. My setup is Windows 7 64 bit and Nuke 6.3v8.

The basic setup is simple:

  1. Copy a file named wingdbstub.py to the same directory as nuke.exe
  2. Create a new python file in the same directory, for example testnuke.py, and write a simple method like: def createBlurNode(): blurNode = nuke.nodes.Blur(). Set a breakpoint.
  3. In the Nuke script editor run: import wingdbstub, then import testnuke, then call the method: testnuke.createBlurNode().
  4. Watch as Wing IDE goes into debug mode and the code stops at the breakpoint
  5. You can now see all the properties of the new blur node.

When I tried it, it didn’t work. So I started digging through wingdbstub.py. The file pulls a bunch of settings together: Where Wing IDE is located, where the wing db password file is located, whether to write to a log, etc. I added debug statements for all the settings and ran wingdbstub.py in Nuke to make sure all the settings were correct.

The code failed when creating the debugger. I emailed Wing IDE support and I have to say they were very helpful. Going back and forth, we discovered an issue which is only an issue on Windows: Nuke Python 2.6.5 is compiled in Visual Studio 2005 (like all of Nuke), but the official version of Python 2.6.5 is compiled in Visual Studio 2008. One of their devs sent me an updated file that included the manifest to bring in msvcr90.dll (Visual Studio 2008). He cautioned me that going forward, this may not be the best fix. But hey, it actually got debugging working. The file I replaced was:

C:\Program Files (x86)\Wing IDE 4.1\bin\2.6\src\debug\tserver\tdbgtracer26_x64.pyd

With the new file, debugging started to work. The key advantage here is to be able to freeze execution and examine the state of nodes and properties. A key downside is that Nuke does not update the UI until you stop stepping through the code and start running it again.

Next, I want to see if I can run code in the Wing Python Shell and have it execute in Nuke. Stay tuned.

Additional Information:

Instructions from Wing IDE can be found here: http://wingware.com/doc/howtos/nuke

You have no rights to post comments

We have 2508 guests and 120 members online