There are some great posts and pages explaining how to setup Wing IDE to remotely debug a Maya session. Eric Pavey first posted how to do this at his WarpCat Blog along with how to send commands back and forth to Maya from Wing.
Luckily, now, many of us are starting to use this workflow and some other little tips and tricks have been discovered. I’d like to spell out all the steps from beginning to end right here.
- Hack wingdbstub.py
- Adjust Remote Debugging preferences in Wing
- Create method to connect to Wing from Maya
- Add pythonpath to module
In detail . . .
1. Hack wingdbstub.py
Copy wingdbstub.py from your:
C:/Program Files (x86)/Wing IDE 4.0/.
and put it into your favorite pythonpath folder with the rest of your development code.
Change the lines:
(~ line 96)
kEmbedded = 0
kEmbedded = 1
and maker sure this line points to your actual installation dir of wing:
(~ line 116)
WINGHOME = r"C:\Program Files (x86)\Wing IDE 4.0"
WINGHOME = r"/Applications/wingIDE/WingIDE.app/Contents/MacOS"
2. Adjust Remote Debugging preference in Wing
In wing goto Edit -> Preferences -> Debugger -> External/Remote
‘Enable Passive Listen’
‘Kill Externally Launched’
Then right click on the bug icon in lower left of Wing’s window and make sure that Passive Listen is enabled
3. Create method to connect to Wing from Maya
Now, make a nice method which you can call from a hotkey in Maya. I’d make a method like this:
# developerTools.py # make sure this method is in a module in your pythonpath def connectToWing(): """ SYNOPSIS Connects to wingIDE debugger INPUTS NONE RETURNS: Nothing """ import wingdbstub try: wingdbstub.Ensure() print 'Connected to wingIDE' except ValueError: print 'Could NOT connect to wingIDE'
Now you can make a hotkey in Maya by adding this as the command in the hotkey editor (suggest CTRL+SHIFT+w):
// this is mel code because that is what hotkey editor recognizes python("import developerTools"); python("reload (developerTools)"); python("developerTools.connectToWing()")
4. Add pythonpath to module
Make sure your the folders that your deverlopTools.py (or wherever you make the connectToWing module) and the folder to your wingdbstub.py are part of your pythonpath. If you ever need to see what pythonpaths your (Maya) environment is aware of, you can just try this:
# prints all pythonpaths for p in sys.path: print p
Actually there are a bunch of handy paths to consider as a developer for Maya, but I’ll save that for next post. 😉
- start Wing
- start Maya
- call connectToWing() method (CTRL+SHIFT+w) (bug should turn green in Wing)
- setup a breakpoint in code in Wing
- call that code from Maya
And if you’re still having trouble, feel free to post questions/comments here or follow these links to my source documentation: