Skip to content

Latest commit

 

History

History
43 lines (42 loc) · 1.03 KB

simpler_version.md

File metadata and controls

43 lines (42 loc) · 1.03 KB

Simpler Version of How to Debug

Suppose that you are connecting to a server via host machine. This tutorial should be transferable for local debugging.

Suppose that you have conda installed on server.

  1. install debugpy using pip
pip install debugpy
  1. install vscode on host
    • install ssh extension and connect to host
  2. install vscode python extension on server
  3. create a launch.json, add the following to configurations.
{
  "name": "Python: Attach",
  "type": "python",
  "request": "attach",
  "connect": {
    "host": "127.0.0.1",
    "port": 5678
  }
}

Suppose that you have a script like this:

#!/bin/bash
python args_test.py \
    "This is arg 1" \
    "This is arg 2"
  1. convert the script and use debugpy
#!/bin/bash
python -m debugpy --listen 127.0.0.1:5678 --wait-for-client args_test.py \
  "This is arg 1" \
    "This is arg 2"
  1. run the script
bash test.sh
  1. navigate to the vscode debug panel, select Python: Attach and run
  2. test that debugging is working properly