question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running example "invoke app.run" fails with "Type Error:Tasks must have an initial Context argument"

See original GitHub issue

Hey,

Sounds like a great project. However I’m trying to run it on my local machine (OSX El-Capitan, Python 2.7.10) and I receive an error:

>> invoke app.run
2016-11-18 12:15:27,067 [WARNING] [tasks.app.db] Alembic cannot be imported, so some app.db.* tasks won't be available!
Traceback (most recent call last):
  File "/usr/local/bin/invoke", line 11, in <module>
    sys.exit(program.run())
  File "/usr/local/lib/python2.7/site-packages/invoke/program.py", line 269, in run
    self._parse(argv)
  File "/usr/local/lib/python2.7/site-packages/invoke/program.py", line 325, in _parse
    self.load_collection()
  File "/usr/local/lib/python2.7/site-packages/invoke/program.py", line 473, in load_collection
    coll = loader.load(coll_name) if coll_name else loader.load()
  File "/usr/local/lib/python2.7/site-packages/invoke/loader.py", line 53, in load
    module = imp.load_module(name, fd, path, desc)
  File "/Users/ilaif/Desktop/flask-restplus-server-example/tasks/__init__.py", line 61, in <module>
    from . import app
  File "/Users/ilaif/Desktop/flask-restplus-server-example/tasks/app/__init__.py", line 8, in <module>
    from . import dependencies, env, db, run, users
  File "/Users/ilaif/Desktop/flask-restplus-server-example/tasks/app/db.py", line 272, in <module>
    def init_development_data(context, upgrade_db=True, skip_on_failure=False):
  File "/Users/ilaif/Desktop/flask-restplus-server-example/tasks/app/_utils.py", line 58, in app_context_task
    return Task(wrapper, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/invoke/tasks.py", line 58, in __init__
    self.positional = self.fill_implicit_positionals(positional)
  File "/usr/local/lib/python2.7/site-packages/invoke/tasks.py", line 149, in fill_implicit_positionals
    args, spec_dict = self.argspec(self.body)
  File "/Users/ilaif/Desktop/flask-restplus-server-example/tasks/app/_utils.py", line 21, in argspec
    return super(Task, self).argspec(body)
  File "/usr/local/lib/python2.7/site-packages/invoke/tasks.py", line 144, in argspec
    raise TypeError("Tasks must have an initial Context argument!")
TypeError: Tasks must have an initial Context argument!

I must be missing something very trivial, I event tried to manually pip install the requirements to make sure I have all the dependencies.

Thanks, Ilai.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
frolcommented, Nov 18, 2016

It seems like you are using Invoke <0.13. Either update it or wait a couple of hours while I backport all new features and fixes back to this example project.

0reactions
frolcommented, Nov 18, 2016

Please, try the latest master. Both invoke 0.12 and 0.13 should work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fabric - Python 3 - What is context and what does it have to ...
To be able to run a @task you need a context argument. Fabric uses invoke task() which expects to see a context object....
Read more >
tasktiger - PyPI
TaskTiger can ensure to never execute more than one instance of tasks with ... an argument. Tasks will have access to Flask's application...
Read more >
Troubleshooting | Apps Script - Google Developers
When your script encounters an error, an error message is displayed. The message is accompanied by a line number used for troubleshooting. There ......
Read more >
Administering Red Hat Satellite Red Hat Satellite 6.9
This guide provides instructions on how to configure and administer a Red Hat Satellite 6 Server. Before continuing with this workflow you must...
Read more >
Oracle® Application Integration Architecture ... - Oracle Help Center
What Are the Oracle AIA Components That I Need to Test? ... Before you start creating and running tests in the Composite Application...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found