do not crash of failed calling of 'cli' method

This commit is contained in:
iLLiCiTiT 2021-11-09 17:55:51 +01:00
parent bf9d4442ea
commit 887e4ba004

View file

@ -47,9 +47,18 @@ class PypeCommands:
from openpype.modules import ModulesManager
manager = ModulesManager()
log = PypeLogger.get_logger("AddModulesCLI")
for module in manager.modules:
if hasattr(module, "cli"):
module.cli(click_func)
try:
module.cli(click_func)
except Exception:
log.warning(
"Failed to add cli command for module \"{}\"".format(
module.name
)
)
return click_func
@staticmethod