./ns3: "help" argument action of store_true is not valid for positional arguments (Python 3.14)
In Python 3.14, the ./ns3
script now shows the following error when triggering the help
command of the parser. Below is the error when running the script with Python 3.14. Please note that some CI/CD jobs (e.g., cmake-format
) use the latest version of Python and are now failing due to this error.
$ ./ns3 configure --enable-modules=core
Traceback (most recent call last):
File "/builds/nsnam/ns-3-dev/./ns3", line 2110, in <module>
main()
~~~~^^
File "/builds/nsnam/ns-3-dev/./ns3", line 1882, in main
args = parse_args(sys.argv[1:])
File "/builds/nsnam/ns-3-dev/./ns3", line 129, in parse_args
parser_help.add_argument(
~~~~~~~~~~~~~~~~~~~~~~~~^
"help", help="Print a summary of available commands", action="store_true", default=False
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/usr/local/lib/python3.14/argparse.py", line 1543, in add_argument
raise ValueError(f'action {action_name!r} is not valid for positional arguments')
ValueError: action 'store_true' is not valid for positional arguments
Edited by Eduardo Almeida