argparse icon indicating copy to clipboard operation
argparse copied to clipboard

Bypass `Unknown Argument:` exception?

Open tt2468 opened this issue 3 years ago • 1 comments

I'm working with an application which has to pass arguments to subprocesses. As such, there are upwards of hundreds of possible arguments that could be done as passthrough, but when I try to pass an argument that isn't explicitly defined, parse_args() gives up. I can catch the initial exception, but fetching the arguments later on throw Nothing parsed, no arguments are available..

Is it somehow possible to get argparse to ignore arguments it doesn't recognize?

tt2468 avatar Jul 04 '22 05:07 tt2468

No, argparse will not ignore unrecognized arguments since v1.6.

I recommend leaving this issue open. Someone may see this and decide to add parse_known_args.

skrobinson avatar Jul 07 '22 14:07 skrobinson