From c7166241f73a969c7ce01fb49a4ae534b16a92b2 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Mon, 7 May 2018 13:12:12 -0400 Subject: [PATCH] Ignore more loading errors (#14331) --- homeassistant/loader.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/loader.py b/homeassistant/loader.py index e94fb2d68330..67647a323c9d 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -105,7 +105,16 @@ def get_component(hass, comp_or_platform) -> Optional[ModuleType]: except ImportError as err: # This error happens if for example custom_components/switch # exists and we try to load switch.demo. - if str(err) != "No module named '{}'".format(path): + # Ignore errors for custom_components, custom_components.switch + # and custom_components.switch.demo. + white_listed_errors = [] + parts = [] + for part in path.split('.'): + parts.append(part) + white_listed_errors.append( + "No module named '{}'".format('.'.join(parts))) + + if str(err) not in white_listed_errors: _LOGGER.exception( ("Error loading %s. Make sure all " "dependencies are installed"), path)