average-school-38756
09/16/2020, 7:32 PM.vscode/launch.json
looking like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach using Process ID",
"type": "python",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
i put this code at the beginning of my ___main___.py
, with a breakpoint as a sanity check (and i have a VS Code breakpoint on the same line):
import debugpy
debugpy.listen(5678)
debugpy.wait_for_client()
debugpy.breakpoint()
i run pulumi up
which shows this output (appears as though wait_for_client
is indeed working):
$ pulumi up
Previewing update (dev):
And i hit F5 to trigger the process attachment. i choose the process called "pulumi up" in the dialog. After ten seconds or so, i get a prompt in VS Code saying "Timed out waiting for debug server to connect.".vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach using listen",
"type": "python",
"request": "attach",
"listen": {
"host": "127.0.0.1",
"port": 5678
}
}
]
}
and in `___main___.py`:
import debugpy
debugpy.connect(('localhost', 5678))
With this method, you start the debugger before running pulumi up
.