Adding manager command with `init_script` fails
- Dominant language
- Python
- Stars
- 50
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
Versions
- Python 2.7.11
- Flask-Script 2.0.5
- Flask-Collect 1.3.2
- Flask 0.11.1
``` python
Traceback (most recent call last):
File "manage.py", line 12, in
from uiapp import app, models, db, manager
File "/Users/pavel/dev/my_proj/my_app/uiapp/__init__.py", line 22, in
collect.init_script(manager)
File "/Users/pavel/.virtualenvs/my_proj/lib/python2.7/site-packages/flask_collect/collect.py", line 119, in init_script
manager.command(collect_proxy)
File "/Users/pavel/.virtualenvs/my_proj/lib/python2.7/site-packages/flask_script/__init__.py", line 285, in command
command = Command(func)
File "/Users/pavel/.virtualenvs/my_proj/lib/python2.7/site-packages/flask_script/commands.py", line 118, in __init__
args, varargs, keywords, defaults = inspect.getargspec(func)
File "/Users/pavel/.pyenv/versions/2.7.11/lib/python2.7/inspect.py", line 816, in getargspec
raise TypeError('{!r} is not a Python function'.format(func))
TypeError: is not a Python function
```
As a workaround, I just added a call to `static`. Seems to work well:
``` python
# manage.py
@manager.command
def collect():
"""Collect static from blueprints."""
return current_app.extensions['collect'].collect()
```
EDIT: commit 9979f22 may have caused this.
##
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38240994-adding-manager-command-with-init_script-fails?utm_campaign=plugin&utm_content=tracker%2F394635&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F394635&utm_medium=issues&utm_source=github).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with flask_collect/collect.py around init_script, then inspect commit 9979f22 and compare it with the working manage.py workaround shown in the report. Reproduce the failure with the listed Python, Flask, Flask-Script, and Flask-Collect versions; done means init_script registers the manager command without the LocalProxy TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, python
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100