mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
Give more info on import errors. (#7128)
This commit is contained in:
parent
1f3754684a
commit
75635956cd
1 changed files with 15 additions and 11 deletions
|
@ -1,17 +1,17 @@
|
|||
import logging
|
||||
from typing import Callable, Optional, Any, ContextManager
|
||||
from types import ModuleType
|
||||
import importlib
|
||||
import importlib.util
|
||||
import importlib.resources
|
||||
import importlib.abc
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from dataclasses import dataclass
|
||||
import importlib
|
||||
import importlib.abc
|
||||
import importlib.resources
|
||||
import importlib.util
|
||||
import logging
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from types import ModuleType
|
||||
from typing import Any, Callable, ContextManager, Optional
|
||||
|
||||
from esphome.const import SOURCE_FILE_EXTENSIONS
|
||||
import esphome.core.config
|
||||
from esphome.core import CORE
|
||||
import esphome.core.config
|
||||
from esphome.types import ConfigType
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -175,7 +175,11 @@ def _lookup_module(domain):
|
|||
try:
|
||||
module = importlib.import_module(f"esphome.components.{domain}")
|
||||
except ImportError as e:
|
||||
if "No module named" not in str(e):
|
||||
if "No module named" in str(e):
|
||||
_LOGGER.error(
|
||||
"Unable to import component %s: %s", domain, str(e), exc_info=False
|
||||
)
|
||||
else:
|
||||
_LOGGER.error("Unable to import component %s:", domain, exc_info=True)
|
||||
return None
|
||||
except Exception: # pylint: disable=broad-except
|
||||
|
|
Loading…
Reference in a new issue