I have a script that receives online arguments using argparse
, like this:
parser = argparse.ArgumentParser()
parser.add_argument(
"--local", action="store_true", help=("Write outputs to local disk.")
)
parser.add_argument(
"--swe", action="store_true", help=("Indicates 'staging' environment.")
)
args = parser.parse_args()
I want argparse
to handle undeclared arguments and just to add them to the arguments dictionary, but it raises an error when I try python runner.py --local true --swe true --undeclared_argument this_is_a_test
:
runner.py: error: unrecognized arguments: --undeclared_argument this_is_a_test