Description
Goal:
Similar to ptvsd's (debugging a script file), I want to launch my script with the pydevd debugger waiting in --server
mode ready to accept connections from a client.
Why:
We are working on implementing remote container debugging for JetBrains IDEs (via a 3rd party plugin). The normal connection mode for pydevd is to run the debug server in the client and make a connection back from the application (in the remote env) to the IDE. I need to reverse this model: run the application and debug server in the remote container, and then connect to it from the IDE.
What I've tried:
Running the pydevd script with --server
, e.g.:
pydevd --server --port [debug_port] --file myscript.py
This appears to only run the debugger, but not the script. I can elicit a response from the debug server by setting breakpoints on the client; however, this appears to be detached from the running app (which I'm currently running separately) so I cannot hit any breakpoints. I've dug up the pydevd_attach_to_process
script where I think I can run the script and then attach the debugger to it but ideally I'd be able to start the script immediately with the debugger. Hopefully this makes some sense. Happy to provide more details.