diff --git a/pm3py/cli/main.py b/pm3py/cli/main.py index 72b0b9b..125d969 100644 --- a/pm3py/cli/main.py +++ b/pm3py/cli/main.py @@ -6,6 +6,7 @@ is left for ``flash`` (wrapping pm3flash) and a future ``client`` command CLI. from __future__ import annotations import argparse +import sys def build_parser() -> argparse.ArgumentParser: @@ -20,6 +21,16 @@ def main(argv: list[str] | None = None) -> int: parser = build_parser() args = parser.parse_args(argv) if args.command == "rawcli": + try: + import prompt_toolkit # noqa: F401 + except ModuleNotFoundError: + print( + "pm3py rawcli needs prompt_toolkit, which isn't installed.\n" + " install it with: pip install 'pm3py[rawcli]'\n" + " or directly: pip install prompt_toolkit", + file=sys.stderr, + ) + return 2 from pm3py.cli.rawcli.app import run return run(port=args.port) parser.print_help()