-
Notifications
You must be signed in to change notification settings - Fork 969
Closed
Description
| Notice that due to the python binding logic we may be mapping |
I have been running into problems when creating the following line
@plugin.method("somename")
def somename(plugin, arg="defaultvalue"):
...
when I called the plugin from the command line interface without argument it worked, but when I passed an argument I received the error:
"Error while processing funds: TypeError(\"multiple values for argument 'plugin'\",)"
and the logfile said:
2019-01-03T13:33:43.907Z plugin-funds.py Traceback (most recent call last):
2019-01-03T13:33:43.907Z plugin-funds.py File \"/Users/rpickhardt/anaconda3/lib/python3.6/site-packages/lightning/plugin.py\", line 160, in _dispatch_request
2019-01-03T13:33:43.907Z plugin-funds.py 'result': self._exec_func(func, request)
2019-01-03T13:33:43.907Z plugin-funds.py File \"/Users/rpickhardt/anaconda3/lib/python3.6/site-packages/lightning/plugin.py\", line 145, in _exec_func
2019-01-03T13:33:43.908Z plugin-funds.py ba = sig.bind(*args, **kwargs)
2019-01-03T13:33:43.908Z plugin-funds.py File \"/Users/rpickhardt/anaconda3/lib/python3.6/inspect.py\", line 2968, in bind
2019-01-03T13:33:43.908Z plugin-funds.py return args[0]._bind(args[1:], kwargs)
2019-01-03T13:33:43.908Z plugin-funds.py File \"/Users/rpickhardt/anaconda3/lib/python3.6/inspect.py\", line 2909, in _bind
2019-01-03T13:33:43.908Z plugin-funds.py arg=param.name)) from None
2019-01-03T13:33:43.908Z plugin-funds.py TypeError: multiple values for argument 'plugin'
I have been studying the method decorators and the dispatching at lines 145, 160 I totally do not understand why this error occurs or why the order is important.
I would however suggest to change #2212 again by putting the plugin argument at the end of the calls and pass plugin=None. Still I am not happy about this way as it seems like an unnecessary boilerplate code.
While I wait for your feedback I will continue to refresh my knowledge about python decorators. Maybe I can come up with a better solution for myself
Metadata
Metadata
Assignees
Labels
No labels