From: http://iwonderwhatjoeisworkingon.blogspot.com/2017/04/debugging-maya-using-visual-studio-code.html
- Install ptvsd
pip install --user ptvsd
- Start ptvsd server in Maya
import ptvsd
ptvsd.enable_attach(address=('0.0.0.0', 3000), redirect_output=True)
- VSCode debug config
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 3000,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}"
}
]
}
]
}
- Start debugging
- Set break point
- Execute code in Maya
Thank you for your tutorial. Standing on your shoulders, I have developed a VS Code extension to simplify the debugging process.
To debug Python code in Maya 2022 or above using VS Code, you can use the "Debugger for Maya" extension available here:
Debugger for Maya
For guidance on how to use it, check out this video tutorial:
Video Tutorial