bots: Use ImportError in Python<3.6 for failed import of bot by name.

This previously caused a traceback if the bot couldn't be found.
This commit is contained in:
neiljp (Neil Pilgrim) 2019-07-26 21:32:02 -07:00
parent f09017ece6
commit 725c7574a5

View file

@ -27,7 +27,9 @@ def import_module_by_name(name: Text) -> Any:
import importlib import importlib
try: try:
return importlib.import_module(name) return importlib.import_module(name)
except ModuleNotFoundError: except ImportError:
return None
except ModuleNotFoundError: # Specific exception supported >=Python3.6
return None return None
def resolve_bot_path(name: Text) -> Optional[Tuple[Text, Text]]: def resolve_bot_path(name: Text) -> Optional[Tuple[Text, Text]]: