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] invoke --list results in IndexError: list index out of range #704
Comments
invoke --list
results in IndexError: list index out of range
invoke --list
results in IndexError: list index out of range
I have identified the bash command pipeline above as an amusing workaround@task(aliases=("list", "lsit", "ist", "-list", "lis", "li", "slit", "slist"))
def _dash_dash_list(c):
"""
because i forget --list often and fixz my ttypos
"""
try: # because pyinvoke issue #704
c.run("invoke --list", hide="err")
except Exception as e:
print("uh oh, https://github.com/pyinvoke/invoke/issues/704")
print("but here, try this...\n")
cmd = 'cat tasks.py | grep def | grep "(\c"' # \c avoid self-reference
print(f"$ {cmd}\n")
c.run(cmd) It's a custom task that is invoked by Honestly, this almost feels like a meme, "yo dawg, I heard you have an invoke bug. So I used invoke to make a workaround for your invoke bug. So you can invoke while working with invoke." The above code allows the following... $ uh oh, https://github.com/pyinvoke/invoke/issues/704
but here, try this...
$ cat tasks.py | grep def | grep "(\c"
def _dash_dash_list(c):
def github(c, username="INSERT_USERNAME", repo="INSERT_REPOSITORY_NAME"):
def github_desktop(c):
def go_to_invoke_docs(c):
def hi(c, name, help=False):
def black_auto_format(c, verbose=True):
def hello_scala(c, verbose=True, name="hello_scala"):
def copy_tasks_py_to_clipboard(c):
def copy_ssh(c): |
It turns out that the above task is an insufficient regex that1. depends on the user being in the same directory as
|
The bug is not due to having too many tasks it's because there is an empty docstring for some of them. |
Interesting! Thanks @draganbobas Sounds like an easy bug to fix with some smarter indexing |
Description of the bug
When running
invoke --list
I receive a traceback containing anIndexError
due to having too many tasks in onetask.py
To Reproduce
Preconditions
1. make an empty folder and change into it
2. download the
task.py
that I was working withSteps To Reproduce
invoke --list
IndexError
$
invoke --list
Workaround
Removing some of the tasks does resolve the
IndexError
but the expected behavior of invoke when runninginvoke --list
is to simply list out all@tasks
without error.Additional details
tasks still work fine
No other tasks are affected. The tasks work just fine. Only
invoke --list
fails.For example, you can still run
here is the list of all tasks within that file
$
cat tasks.py | grep def | grep "(c"
Cleanup after reproducing bug
The text was updated successfully, but these errors were encountered: