diff --git a/maigret/__init__.py b/maigret/__init__.py index 3cf3f11..8f8024c 100644 --- a/maigret/__init__.py +++ b/maigret/__init__.py @@ -7,7 +7,18 @@ __author_email__ = 'soxoj@protonmail.com' from .__version__ import __version__ -from .checking import maigret as search +try: + from .checking import maigret as search +except ImportError as e: + raise ImportError( + "Missing required dependency while starting Maigret.\n\n" + "If installed from PyPI:\n" + " pip install -U maigret\n\n" + "If running from a cloned repository:\n" + " pip install -e .\n\n" + "Then run Maigret as:\n" + " python -m maigret " + ) from e from .maigret import main as cli from .sites import MaigretEngine, MaigretSite, MaigretDatabase from .notify import QueryNotifyPrint as Notifier diff --git a/maigret/maigret.py b/maigret/maigret.py index c33277e..f3d0bfa 100755 --- a/maigret/maigret.py +++ b/maigret/maigret.py @@ -13,7 +13,19 @@ from argparse import ArgumentParser, RawDescriptionHelpFormatter from typing import List, Tuple import os.path as path -from socid_extractor import extract, parse # type: ignore[import-not-found] +try: + from socid_extractor import extract, parse +except ImportError as e: + raise ImportError( + "Missing dependency: socid_extractor\n\n" + "If installed from PyPI:\n" + " pip install -U maigret\n\n" + "If running from a cloned repository:\n" + " pip install -e .\n\n" + "Then run Maigret as:\n" + " python -m maigret " + ) from e + from .__version__ import __version__ from .checking import (