Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I pass arguments to the python interpreter like "-u" in launch.json configurations?

I am trying to call python -u file.py in VS Code debug mode. I get that I can use the "args" field to specify arguments, but what about python interpreter flags?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

If you’re using "type": "python" in your launch configuration, just use the "pythonArgs" field and pass an array of arguments (as strings) to pass to the python interpreter.

That field’s description:

Command-line arguments passed to the Python interpreter. To pass arguments to the debug target, use "args".

For example:

{
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true,
            "pythonArgs": ["-u"]
        }
    ]
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading