-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Tuples as Multi Value Options throw an TypeError #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The problem is that Click does not have a way currently to define default values for |
Yay, it works! Thank you. By the way... your projects are brilliant and i use them like everyday. So on this way: thank you 😄 |
Hello @mitsuhiko , Is it possible to use default values for And thanks for building |
Multi-type defaults appear to work now for
|
if you make a multi-type argument required and set defaults, does that make it not actually behave as if it is required? |
Hi, I caught the same bug. And want to get some explanation about the internals of option. am I right or not. All option parameters pass explicitly through a context of decorators of Click? How could I prevent passing an option if it is not defined? @click.command(...)
@click.argument(...)
@click.option("--r", ...)
@click.option("--i", nargs=3, type=click.Tuple([click.File, click.File, click.Choide(...)]))
def something(arg,opt1,opt2) I cannot understand why if last option("--i") is not given the program crashes with TypeError: ......
File "~/.virtualenvs/.../local/lib/python2.7/site-packages/click/types.py", line 472, in convert
raise TypeError('It would appear that nargs is set to conflict '
TypeError: It would appear that nargs is set to conflict with the composite type arity. I think it occurs because first option parameter has a default value, but the second one no I've added multiple equals True, but it is not a multiple option. I read the Docu and think so a multiple parameter is not for a scenario that I've needed . I want just option with 3 args( --i param param param ) |
@rojaster as stated by @mitsuhiko:
so, in your case, if you want to have 3 arguments to an option, you have to set "default=(None, None, None)". |
Hi,
sorry if i do something wrong but i dont even get the example code working. i tried to put this into my code
And i will always get this
so i tried it with Python2.7... still the same error. Then i created a fresh Python2.7 virtualenv and used the example
and running it with
python foo.py
still throws the error. I dont know if this is just a question, or if im doing something wrong and i know the "issues" section here is not for questions but maybe its some kind of a bug and i dont know what i else could do about this. so forgive me if its just my problem 😏The text was updated successfully, but these errors were encountered: