mirror of
https://github.com/soxoj/maigret.git
synced 2026-05-06 14:08:59 +00:00
Improve startup error message for missing dependencies (#2593)
* Improve startup error message for missing dependencies * Enhance error message for missing dependencies Updated import error message to include installation instructions for PyPI and cloned repository. * Enhance missing dependency error message Updated error message for missing dependency to include installation instructions for both PyPI and local repository.
This commit is contained in:
+12
-1
@@ -7,7 +7,18 @@ __author_email__ = 'soxoj@protonmail.com'
|
|||||||
|
|
||||||
|
|
||||||
from .__version__ import __version__
|
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 <username>"
|
||||||
|
) from e
|
||||||
from .maigret import main as cli
|
from .maigret import main as cli
|
||||||
from .sites import MaigretEngine, MaigretSite, MaigretDatabase
|
from .sites import MaigretEngine, MaigretSite, MaigretDatabase
|
||||||
from .notify import QueryNotifyPrint as Notifier
|
from .notify import QueryNotifyPrint as Notifier
|
||||||
|
|||||||
+13
-1
@@ -13,7 +13,19 @@ from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|||||||
from typing import List, Tuple
|
from typing import List, Tuple
|
||||||
import os.path as path
|
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 <username>"
|
||||||
|
) from e
|
||||||
|
|
||||||
|
|
||||||
from .__version__ import __version__
|
from .__version__ import __version__
|
||||||
from .checking import (
|
from .checking import (
|
||||||
|
|||||||
Reference in New Issue
Block a user