Mercurial > libervia-backend
comparison libervia/cli/base.py @ 4253:5115976e1e3d
cli (base): catch all failure on plugin importing.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 31 May 2024 11:22:10 +0200 |
parents | d01b8d002619 |
children | 0d7bb4df2343 |
comparison
equal
deleted
inserted
replaced
4252:02a7860486b5 | 4253:5115976e1e3d |
---|---|
535 for module_name in modules: | 535 for module_name in modules: |
536 module_path = "libervia.cli." + module_name | 536 module_path = "libervia.cli." + module_name |
537 try: | 537 try: |
538 module = import_module(module_path) | 538 module = import_module(module_path) |
539 self.import_plugin_module(module, type_) | 539 self.import_plugin_module(module, type_) |
540 except ImportError as e: | |
541 self.disp( | |
542 _("Can't import {module_path} plugin, ignoring it: {e}") | |
543 .format(module_path=module_path, e=e), | |
544 error=True) | |
545 except exceptions.CancelError: | 540 except exceptions.CancelError: |
546 continue | 541 continue |
547 except exceptions.MissingModule as e: | 542 except exceptions.MissingModule as e: |
548 self.disp(_("Missing module for plugin {name}: {missing}".format( | 543 self.disp(_("Missing module for plugin {name}: {missing}".format( |
549 name = module_path, | 544 name = module_path, |
550 missing = e)), error=True) | 545 missing = e)), error=True) |
546 except Exception as e: | |
547 self.disp( | |
548 _("Can't import {module_path} plugin, ignoring it: {e}") | |
549 .format(module_path=module_path, e=e), | |
550 error=True) | |
551 | 551 |
552 | 552 |
553 def import_plugin_module(self, module, type_): | 553 def import_plugin_module(self, module, type_): |
554 """add commands or outpus from a module to CLI frontend | 554 """add commands or outpus from a module to CLI frontend |
555 | 555 |