Hi,
Excellent idea, just it is not working out of the box.
I've installed the pyapp
running:
Then the error comes when I run the app with no arguments:
pyapp
Traceback (most recent call last):
File "/Users/luis/.virtualenvs/ca-env/bin/pyapp", line 8, in <module>
sys.exit(main())
File "/Users/luis/.virtualenvs/ca-env/lib/python3.7/site-packages/pyapp/cli.py", line 31, in main
command = args.command
AttributeError: 'Namespace' object has no attribute 'command'
However, if I run the app with the correct command hello
, I believe the app works:
Now, if I added command as an argument on the parent parser:
parser.add_argument("command", action="store",help="test command")
The app runs as expected with no arguments:
pyapp
usage: pyapp [-h] [-c CONFIG] [-v] [-w WARN] command {hello} ...
pyapp: error: the following arguments are required: command
But generates errors with the command argument hello
:
pyapp hello
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 1126, in getfullargspec
sigcls=Signature)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 2208, in _signature_from_callable
raise TypeError('{!r} is not a callable object'.format(obj))
TypeError: 'hello' is not a callable object
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/luis/.virtualenvs/ca-env/bin/pyapp", line 8, in <module>
sys.exit(main())
File "/Users/luis/.virtualenvs/ca-env/lib/python3.7/site-packages/pyapp/cli.py", line 33, in main
spec = getfullargspec(command)
File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/inspect.py", line 1132, in getfullargspec
raise TypeError('unsupported callable') from ex
TypeError: unsupported callable
I'm new at programming and don't know how to fix it.
Could you take a look, please?