-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi,
$ pip show clize
Name: clize
Version: 4.0.3
Summary: Turn functions into command-line interfaces
Home-page: https://github.com/epsy/clize
Author: Yann Kaiser
Author-email: kaiser.yann@gmail.com
License: MIT
Location: .../lib/python3.6/site-packages
Requires: docutils, six, sigtools, od, attrsHere is a sample program to reproduce the traceback.
from sigtools.wrappers import decorator
from clize import run
@decorator
def f(a, *args, name=False, **kwargs):
args = args
return a(*args, **kwargs)
@f
def g():
pass
run(g)Here is the crash :
$ python -m pdb my-sigtool.py --help
Traceback (most recent call last):
File "my-sigtool.py", line 16, in <module>
run(g)
File ".../lib/python3.6/site-packages/sigtools/modifiers.py", line 158, in __call__
return self.func(*args, **kwargs)
File ".../lib/python3.6/site-packages/clize/runner.py", line 360, in run
ret = cli(*args)
File ".../lib/python3.6/site-packages/clize/runner.py", line 220, in __call__
return func(*posargs, **kwargs)
File ".../lib/python3.6/site-packages/clize/runner.py", line 220, in __call__
return func(*posargs, **kwargs)
File ".../lib/python3.6/site-packages/sigtools/modifiers.py", line 158, in __call__
return self.func(*args, **kwargs)
File ".../lib/python3.6/site-packages/clize/help.py", line 887, in cli
help = self.get_help()
File ".../lib/python3.6/site-packages/clize/help.py", line 896, in get_help
return self.builder(self.subject, self.owner)
File ".../lib/python3.6/site-packages/clize/help.py", line 449, in from_subject
ret.add_from_parameter_sources(subject)
File ".../lib/python3.6/site-packages/clize/help.py", line 491, in add_from_parameter_sources
for func in func_signature.sources[pname]:
KeyError: 'args'
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> .../lib/python3.6/site-packages/clize/help.py(491)add_from_parameter_sources()
-> for func in func_signature.sources[pname]:
(Pdb) pp func_signature.sources
{'+depths': {<function g at 0x7f700f11f950>: 3,
<function _SimpleWrapped.__call__ at 0x7f70113f89d8>: 0,
<function f at 0x7f7011d7d950>: 2,
functools.partial(<function f at 0x7f7011d7d950>, <function g at 0x7f700f11f950>): 1},
'name': [<function f at 0x7f7011d7d950>]}
(Pdb)
I expect a more insightful error. I'm wondering wheither the bug is in clize or sigtools.
I found a workaround : i edit kwargs instead of varargs.
epsy
Metadata
Metadata
Assignees
Labels
No labels