-
-
Notifications
You must be signed in to change notification settings - Fork 672
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
[BUG] Error: Got unexpected extra argument #233
Comments
When you only have one command, like in your first example, there is no need to specify the name of the command you want to run. Typer sees that you only have one command to run, therefore the user must be intending to run that command. So your first example should just be |
Thanks @daddycocoaman. |
I don't think that's a good "design choice". Very confusing and weird. Why not support both cases when only 1 app.command wrapped func? |
This should be on the first page of the documentation |
I want to second this comment, it costs me entire day to figure out the root cause. |
I had the same problem for a while and found the page where it says if there is only one command defined in the app, but still want to use its name, there needs to be a callback defined : https://typer.tiangolo.com/tutorial/commands/one-or-multiple/ |
It'd be great so support both cases e.g. |
I lost a lot of a time to encounter the problem! I don't understand why this design choose. I agree with @zanieb support both cases is the best option. |
I just learned
https://github.com/BrianPugh/cyclopts fixed the latter with |
@nguyenvulong please open up an issue in the cyclopts repo for the first point; we can probably figure something out. Thanks! |
Error: Got unexpected extra argument (serve) FROM python:3.8-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && RUN pip install torch==1.10.0 torchvision==0.11.1 cython pyyaml>6.0 WORKDIR /app COPY requirements.txt /app/ COPY inference.py /app/ RUN pip install uvicorn ENTRYPOINT ["uvicorn", "inference:app", "--host", "0.0.0.0", "--port", "8080"] |
Describe the bug
Error: Got unexpected extra argument
while calling a function using typer.Write here a clear and concise description of what the bug is.
I have specified 3 arguments for a function and getting the above error while using typer. my code looks like this.
python infer.py generate-csv "xxx" "yyy" "lightning_logs/version_3/checkpoints/epoch=18-step=10164.ckpt"
Error
however this error disappears and it works normally if I add another function as below and wrap it with typer.
python infer.py generate-csv "xxxx" "yyyy" "lightning_logs/version_3/checkpoints/epoch=18-step=10164.ckpt"
output:
Environment
ubuntu 16.04
and Anaconda python 3.6 environment.typer==0.3.0
The text was updated successfully, but these errors were encountered: