Debugging Maya using Visual Studio Code
I've been testing debugging Maya Python scripts lately. Mostly focusing on free IDEs or editors such as PyCharm. So far this is one requires less setup in my opinion.
This is mostly based off the remote python debugging functionality described here:
- Download and install Microsoft's free Visual Studio Code
- Install the official Python Extension
- Download ptvsd package as a zip
- Extract the ptvsd folder into your Maya scripts folder
- Open Maya and run (updated! Thanks Luciana!)import ptvsdptvsd.enable_attach(address=('0.0.0.0', 3000), redirect_output=True)
- Back in VSC, switch to Attach (remote debug) in the debug configurations and start it
The editor should now look something like this
- You are now ready to debug.
Note: here is the settings I use in launch.json