The following script works with the base click
library but raises an exception with the django-click
library.
import djclick as click
@click.command()
@click.argument("name", help="Some name")
def command(name):
click.echo(f"Hi {name}!")
Exception:
Traceback (most recent call last):
File "/app/./manage.py", line 22, in <module>
main()
File "/app/./manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 244, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 37, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/app/core/management/commands/click1.py", line 6, in <module>
def command(name):
File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 168, in decorator
_param_memo(f, ArgumentClass(param_decls, **attrs))
File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1984, in __init__
Parameter.__init__(self, param_decls, required=required, **attrs)
TypeError: __init__() got an unexpected keyword argument 'help'