pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.38k stars 367 forks source link

@task(pre=[call(setup, 'qwe')]) fails with "NameError: name 'call' is not defined" #986

Closed ibc closed 7 months ago

ibc commented 7 months ago

I'm using invoke 2.2.0 and following the docs https://docs.pyinvoke.org/en/stable/concepts/invoking-tasks.html#parameterizing-pre-post-tasks to make a task B pass arguments to another task A that it depends on.

@task
def setup(ctx, foo='lalala'):

@task(pre=[call(setup, foo='qwe')])
def another_task(ctx):

It just fails:

  File "/xxxxx/pip_invoke/invoke/loader.py", line 91, in load
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/ibc/src/v3-mediasoup/worker/tasks.py", line 469, in <module>
    @task(pre=[call(setup, foo='qwe')])
               ^^^^
NameError: name 'call' is not defined. Did you mean: 'all'?

Do I miss something?

ibc commented 7 months ago

False alarm, sorry. I forgot to import call from invoke module.