k. I dug a little bit in to all of that.
Good news: No Need for debugpy ! vsCode takes care of that itself.
I looked a little bit in to your repository and was pretty confused about some stuff:
- Why did you comment out anything reffering Ports and Network when Debugpy is running in a network?
- Whats with the error-messages?
- Debugpy probably being async, it should not work nonblocking anyway.
In fact, the most important part is your .vscode.
in your projectFolder, create a folder named .vscode and create a file called launch.json
{
"configurations": [
{
"name": "Python: Attach using Process Id",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}",
"justMyCode": true,
"pathMappings": [{
"localRoot": "${workspaceFolder}/modules/suspects",
"remoteRoot": "c:"
}]
}
]
}
Rightclick in your projectFolder to open vsCode, go to “Run and Debugging”/Ctrl+Shift+D and press the play button and select TouchDesigner as the process.
TIMEOUT ERROR
Often it will need some time to ramp up. The default is 15 seconds, which might be not enough.
To give it more time, open commandline and run
setx DEBUGPY_PROCESS_SPAWN_TIMEOUT 90
Restart vsCode for it to fetch the envVariable and of you go.
pathMapping
Wwe need pathMapping to enable vscode to understand the paths of the modules td gives.
For some reason, /anythin will be understood as $DRIVE_LETTER/anything
This means, when we are on C:, /anything will be interpreted as C:/anything
For that we need to tell vscode to map $DRIVE_LETTER to the folder where our files live.
For me, making use of my PrivateInvestigator it is pretty simple. This is was the esample above is.
Only downside, we have to adjust the driveLetter by hand.
I suppose we could write a startupscript in touch that is setting this by itself via python.
Caviat
At the moment it seems the dbugger does not map from module/path to file.
This means to get real debugging, we need to ommit the .py on the end of our files. Not ideal as we are lossing intellisense and similiar. So have to see if there is a better way.
Breakpoints
Setting breakpoints in VSCODE does nothing as it seems. But you can still install debugby via TD_PIP and use the breakpoint function by hand. Not ideal, but at least something.
Happy debuggin!
@robmc Soooo. About that new fileformat? Having all dats being auto 1 to 1 mapped files in the project would make this like SOOOOOO good.