Skip to content

Custom binary + default task + missing arguments gives traceback #562

@SwampFalc

Description

@SwampFalc

I'm not 100% certain which part of the code stack is exactly the issue here, but I made a custom binary, gave it a collection of tasks with one marked default (which needs one parameter).

If I just call the binary with its default task and no parameter, I get the standard invoke error message:

$ exportit execute
'execute' did not receive required positional arguments: 'export_type'

However, if I just call the binary and rely on the fact that that one task is defined as default, then I get a traceback error:

$ exportit
Traceback (most recent call last):
  File "/home/ldt/.virtualenvs/matchit/bin/exportit", line 11, in <module>
    sys.exit(program.run())
  File "/usr/local/lib/python2.7/dist-packages/invoke/program.py", line 332, in run
    self.execute()
  File "/usr/local/lib/python2.7/dist-packages/invoke/program.py", line 480, in execute
    executor.execute(*self.tasks)
  File "/usr/local/lib/python2.7/dist-packages/invoke/executor.py", line 133, in execute
    result = call.task(*args, **call.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/invoke/tasks.py", line 127, in __call__
    result = self.body(*args, **kwargs)
TypeError: execute() takes at least 2 arguments (1 given)

Which is of course a bit surprising and annoying, since I would prefer to also see the first behaviour in this case.

Do note that the custom binary was achieved by using the setup.py "entry_points/console_scripts" method.

(Let me know if you also want me to copy/paste the content of the file defining the Collection and Program instances, they're very basic so I sort of assume they're of little use...)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions