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

argh==0.31.0 breaks (my) argh.dispatch_command call #85

Closed
thorwhalen opened this issue Jan 15, 2024 · 1 comment
Closed

argh==0.31.0 breaks (my) argh.dispatch_command call #85

thorwhalen opened this issue Jan 15, 2024 · 1 comment

Comments

@thorwhalen
Copy link

Sorry not to give further details but I had the choice between sending a quick issue or not mentioning it at all.

My script, that uses argh, stopped working when I updated to argh==0.31.0 from argh==0.26.2.

The error

    argh.dispatch_command(populate_pkg_dir)
  File "~/.pyenv/versions/p10/lib/python3.10/site-packages/argh/dispatching.py", line 470, in dispatch_command
    set_default_command(parser, function, name_mapping_policy=name_mapping_policy)
  File "~/.pyenv/versions/p10/lib/python3.10/site-packages/argh/assembling.py", line 420, in set_default_command
    inferred_args: List[ParserAddArgumentSpec] = list(
  File "~/.pyenv/versions/p10/lib/python3.10/site-packages/argh/assembling.py", line 183, in infer_argspecs_from_function
    TypingHintArgSpecGuesser.typing_hint_to_arg_spec_params(
  File "~/.pyenv/versions/p10/lib/python3.10/site-packages/argh/assembling.py", line 778, in typing_hint_to_arg_spec_params
    item_type = cls._extract_item_type_from_list_type(first_subtype)
  File "~.pyenv/versions/p10/lib/python3.10/site-packages/argh/assembling.py", line 799, in _extract_item_type_from_list_type
    if args[0] in cls.BASIC_TYPES:
IndexError: tuple index out of range

My guess is that the len(args) == 0 case is not handled properly?

Without looking further, I'd suggest:

 if args and (args[0] in cls.BASIC_TYPES):

instead?

If I have time, I'll look at it further this week and send a PR.

@thorwhalen
Copy link
Author

Wrong argh repository.
Copied to the correct one: neithere/argh#216

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant