From 2be779ccae8cbcf86ae9b36ae1003f70c23f05f9 Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Sat, 18 Jul 2020 16:40:21 -0400 Subject: Added an additional check for isinstance(method, Callable) since there are scenarios where inspect.ismethod() fails for some reason --- cmd2/cmd2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'cmd2') diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 25251bef..2215f818 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -432,7 +432,8 @@ class Cmd(cmd.Cmd): cmdset.on_register(self) methods = inspect.getmembers( cmdset, - predicate=lambda meth: inspect.ismethod(meth) and meth.__name__.startswith(COMMAND_FUNC_PREFIX)) + predicate=lambda meth: (inspect.ismethod(meth) or isinstance(meth, Callable)) and + meth.__name__.startswith(COMMAND_FUNC_PREFIX)) installed_attributes = [] try: -- cgit v1.2.1