Skip to content
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] Example not working as expected #4

Closed
enbermudas opened this issue Dec 26, 2019 · 6 comments
Closed

[BUG] Example not working as expected #4

enbermudas opened this issue Dec 26, 2019 · 6 comments
Labels
bug Something isn't working

Comments

@enbermudas
Copy link

Describe the bug

Write here a clear and concise description of what the bug is.

To Reproduce

  • Create a file main.py with:
import typer

app = typer.Typer()

@app.command()
def hello(name: str, formal: bool = False):
    if formal:
        typer.echo(f'Hello {name}')
    else:
        typer.echo(f'Whaaaasuuuup {name}')

if __name__ == '__main__':
    app()
  • Call it with:
python main.py --formal John
  • It outputs:
Error: Got unexpected extra argument (Kike)
  • But I expected it to output:
Hello John

Environment

  • OS: Linux (Ubuntu 18.04)
  • Typer Version: 0.0.4
python -c "import typer; print(typer.__version__)"
  • Python version: 3.6.9
@enbermudas enbermudas added the bug Something isn't working label Dec 26, 2019
@kousikmitra
Copy link

kousikmitra commented Dec 26, 2019

@enbermudas
Try with
python main.py John --formal

Edit
python main.py --formal John is also working for me.

Environment

  • OS: Windows 10 (10.0.18362)
  • Typer Version: 0.0.4
  • Python version: 3.7.4

@enbermudas
Copy link
Author

It throws the exact same error with this:

python main.py John --formal

@kousikmitra
Copy link

It throws the exact same error with this:

python main.py John --formal

Both the command is working for me. I have updated my reply.

@enbermudas
Copy link
Author

I just closed and reopened my terminal and it is working now. Weird problem.

@enbermudas
Copy link
Author

Closing the issue.

@tiangolo
Copy link
Owner

Thanks for the help here @kousikmitra ! 👏 🙇

Thanks for reporting back and closing the issue @enbermudas 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants