2

I am trying to debug a python program that takes a module as argument ( see args). The launch.json config is below:

{
        "name": "Python: Actions",
        "type": "python",
        "request": "launch",
        "module": "my_module",
        "args": [
            "--module",
            "module"
        ],
        "cwd": "/cwd",
        "console": "integratedTerminal"
},

When I run the program like this it works: python -m my_module --module module

However, when I launch the debug config, it can't find the module passed as argument. Here is command line statement issued by vscode when I launch de config:

cd /cwd ; env "PYTHONIOENCODING=UTF-8" "PYTHONUNBUFFERED=1" /path/to/python ~/.vscode/extensions/ms-python.python-2018.12.1/pythonFiles/ptvsd_launcher.py --default --client --host localhost --port 60664 -m my_module --module module
1

1 Answer 1

1

At the moment, VSCode's CLI parser needs a little help to avoid confusing its arguments with the module's:

{
        "name": "debugging-my-module",
        "type": "python",
        "request": "launch",
        "module": "my_module",
        "args": [
            "--"
            "optional", 
            "args",
            "for",
            "your",
            "module",
        ],
        "console": "integratedTerminal"
},
Sign up to request clarification or add additional context in comments.

2 Comments

Is your suggestion to remove the cwd option?
No, it is fine. Do add an extra "--" argument, that is what does the trick here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.