-
-
Notifications
You must be signed in to change notification settings - Fork 3
Using the Python Debugger
Matthew Beech edited this page Nov 18, 2024
·
2 revisions
- Select
Run > Add Configuration
from the VS Code menu bar. - Select
Python
, and thenModule
, and enter the name of the module you want to debug, e.g.silnlp.nmt.translate
. - Edit configuration.
- Add the option
"console": "integratedTerminal"
- Change
"justMyCode"
to"false"
- Add
"args": []
and fill the list with the arguments needed to run the module. See example below. - (Optional) To change or add environment variables for the duration of the debugger run, add
"env": {}
and put any variables you want in the dictionary. See example below. - (Optional) Change
"name"
to match the module
- Add the option
- To run, open the
Run and Debug
tab in VS Code (Ctrl+Shift+D
), select a module at the top, and click the play button.
{
"version": "0.2.0",
"configurations": [
{
"name": "NMT Translate",
"type": "python",
"request": "launch",
"console": "integratedTerminal",
"justMyCode": false,
"module": "silnlp.nmt.translate",
"args": [
"experiment_dir",
"--clearml-queue",
"jobs_backlog",
"--src-project",
"NIV11",
"--books",
"1JN"
],
"env": {
"SIL_NLP_DATA_PATH": "/home/user/alternate_data_path"
}
},
],
}