I want to use the pythons argparse module to parse my cli parameter string. This works for the parameters a pass from terminal, but not with a given string.
parser.parse_args()
expects a sequence in the same form as sys.argv[1:]
. If you treat a string like a sys.argv sequence, you get ['s', 'o', 'm', 'e', 'T', 'e', 's', 't', 'F', 'i', 'l', 'e']
. 's' becomes the relevant argument, and then the rest of the string is unparseable.
Instead, you probably want to pass in parser.parse_args(['someTestFile'])