Note: Wing can interact with Maya in three different ways. This is one of the three. See an overview here on the whole system: Interaction between Wing and Maya
I currently do all my Python authoring in Wing (professional). As explained in other subjects (see note above) I have it setup so I can execute commands in Wing, and send them to Maya, which allows me to prettymuch bypass the script editor. More or less.
There are some instances where I need to leave the code in wing, but have it act on a physical Maya file in Maya. To do this, Wing lets you setup remote debugging: What does this give you? You set break-points in you code in Wing. You execute Python code in Maya. When the break-point is hit, Maya halts, and you can then start debugging in the Wing window, but physically querying the data from the open Maya session.
Since I’ve authored this, I found that Maya’s official documentation has been updated as well to show this process, here (under ‘Using Wing IDE with Maya ‘)
Here’s how to set it up:
(Find the official Wing docs for this here)
- Copy these two files to the directory that the module you want to debug lives in. OR, you can simply put them somewhere in your Python path, and import them into your module from there (both methods work equally well it seems).
wingdebugw (no extension) from Wing’s user settings directory
C:\Documents and Settings\\Application Data\Wing IDE 3\wingdebugpw
C:\Users\\AppData\Roaming\Wing IDE 3\wingdebugpw
wingdbstub.py from the Wing IDE installation directory
C:\Program Files\Wing IDE X.X\wingdbstub.py
C:\Program Files (x86)\Wing IDE X.X\wingdbstub.py
- It is important that in wingdbstub.py on around line 90, you set ‘kEmbedded = 1’. Elsewise, things just may not work so well….
- In the module you want to debug, you need to import wingdbstub.py, since this tells Wing where to start debugging:
# If you are using Wing 4.0, they recommend you then call to this:
- In your Wing preferences, under ‘Debugger: External/Remote’, you need to turn on:
- ‘Enable Passive Listen’
- ‘Kill Externally Launched’
- You may also need to also turn on ‘Enable Passive Listen’ in the Wing ‘Debugger’ menu, which is the “bug-looking button” at the very bottom-left of the UI (better safe than sorry)
- In your Wing Project Properties UI, make sure that you have the Python Executable set to Maya’s version of Python. For Maya 2008, it lives here:
To start the debugging, set some breakpoints in your module in Wing.
In Maya, then import and execute your code:
- Note: Do not import wingdbstub in this code.
At which point Maya should ‘hang’ at each breakpoint Wing hits, and you can start checking the Stack Data (etc) in Wing while running the debugger.
That’s more or less it. The connection between the two apps seems a bit twitchy though, so it often times requires a restart of Maya to make the systems reconnect again.
- If you “Stop Debugging” in Wing, it will shut down Maya (based on the above set prefs). If debugging finishes successfully, Maya will stay open (in theory).
- Really bad errors can break the connection to Maya, at which point you’ll need to restart Maya, to get the connection back.