I'm trying to debug the following script in VS code:
import os
import argparse
def parseArgs():
parser = argparse.ArgumentParser()
parser.add_argument("-cn", "--cert_names", nargs="+", default=None, help='Provide one or several cert names to be created')
parser.add_argument('-pw', '--password', action='store_true', help='Provide a password for private keys and certs')
args = parser.parse_args()
if not args.cert_names:
print("Please provide one or more cert names")
def main():
parseArgs()
print(args.cert_names)
This is the launch.json file I'm using:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File and libraries",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode" : false,
"args": ["-cn cert1 cert2 cert3 cert4"],
"cwd": "${fileDirname}",
}
]
}
After I run the debugger in VS code I get the following message: create_certs.py: error: unrecognized arguments: -cn cert1 cert2 cert3 cert4
What I want is to pass that list as an argument to the script, I've also tried with "args": ["--cert_names cert1 cert2 cert3 cert4"], and same result,
Does anyone know where I am going wrong?