From bf5d6c3dfb0e189c2652fae487b3560551c4fcfb Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Sun, 8 Oct 2023 18:07:51 -0400 Subject: [PATCH] raise ModuleNotFoundError instead Signed-off-by: Jinzhe Zeng --- deepmd/entrypoints/gui.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/deepmd/entrypoints/gui.py b/deepmd/entrypoints/gui.py index 475818e9b0..8b6b9e0a09 100644 --- a/deepmd/entrypoints/gui.py +++ b/deepmd/entrypoints/gui.py @@ -14,13 +14,18 @@ def start_dpgui(*, port: int, bind_all: bool, **kwargs): to the network on both IPv4 and IPv6 (where available). **kwargs additional arguments + + Raises + ------ + ModuleNotFoundError + The dpgui package is not installed """ try: from dpgui import ( start_dpgui, ) - except ModuleNotFoundError: - raise RuntimeError( + except ModuleNotFoundError as e: + raise ModuleNotFoundError( "To use DP-GUI, please install the dpgui package:\npip install dpgui" - ) + ) from e start_dpgui(port=port, bind_all=bind_all)