TypeError: It would appear that nargs is set to conflict with the composite type arity TypeError: It would appear that nargs is set to conflict with the composite type arity json json

TypeError: It would appear that nargs is set to conflict with the composite type arity


There are a couple of ways you can fix this.

Do not use click.Tuple

Tuple is intended for a multiple valued argument of non-uniform type. Since you are using 6 strings, this can be done more simply with:

@click.option('--new_profile', '-n',              nargs=6,              type=str,              ....

Use click.Tuple with a default

As you discovered you can use a click.Tuple if you specify a default.

@click.option('--new_profile', '-n',              default=[None] * 6,              type=click.Tuple([str, str, str, str, str, str]),              ....

Then you can qualify that you did not get the default like:

if new_profile and None not in new_profile:    # create a new profile    ....