Home > OS >  VS Code - Debugger gives module error, but running same command from terminal works
VS Code - Debugger gives module error, but running same command from terminal works

Time:03-28

So I have this launch.json

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Run main.py",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/main.py",
            "console": "integratedTerminal",
            "justMyCode": true,
            "args": ["-o", "storage/test",
                "-b", "projects/robustnav_baselines/experiments/robustnav_train", "objectnav_robothor_vanilla_rgb_augmenter_resnet_ddppo",
                "-trd", "dylan/subsample_task/1_percent/train"]
        }
    ]
}

Which essentially runs this command python main.py -o storage/test -b projects/robustnav_baselines/experiments/robustnav_train objectnav_robothor_vanilla_rgb_augmenter_resnet_ddppo -trd dylan/subsample_task/1_percent/train. When I run this command in the vs code terminal it runs fine, but when I use the debugger associated with the launch.json file. I get this exception:

allenact/init.py enter image description here

Then as we can see workspaceFolder is at the root

enter image description here

So I'm not sure why it's not finding the allenact module even though you can clearly access it from the root as it is a folder accessible in the root with an __init__.py file.

Here is my terminal output when I run debugger. VS code will output commands in terminal when you run debugger:

cd /home/dyung6/robustnav ; /usr/bin/env /home/dyung6/anaconda3/envs/robustNav/bin/python /home/dyung6/.vscode-server/extensions/ms-python.python-2022.2.1924087327/pythonFiles/lib/python/debugpy/launcher 33361 -- /home/dyung6/robustnav/main.py -o storage/test -b projects/robustnav_baselines/experiments/robustnav_train objectnav_robothor_vanilla_rgb_augmenter_resnet_ddppo -trd dylan/subsample_task/1_percent/train

CodePudding user response:

Open the "run and debug" tab from the sidebar and at the bottom you would find a section called "breakpoints".

Under that, uncheck "raised exceptions" and "user uncaught exceptions".

  • Related