Skip to content

Commit

Permalink
raise ModuleNotFoundError instead
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Oct 8, 2023
1 parent 98aecd5 commit bf5d6c3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions deepmd/entrypoints/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (

Check warning on line 24 in deepmd/entrypoints/gui.py

View check run for this annotation

Codecov / codecov/patch

deepmd/entrypoints/gui.py#L23-L24

Added lines #L23 - L24 were not covered by tests
start_dpgui,
)
except ModuleNotFoundError:
raise RuntimeError(
except ModuleNotFoundError as e:
raise ModuleNotFoundError(

Check warning on line 28 in deepmd/entrypoints/gui.py

View check run for this annotation

Codecov / codecov/patch

deepmd/entrypoints/gui.py#L27-L28

Added lines #L27 - L28 were not covered by tests
"To use DP-GUI, please install the dpgui package:\npip install dpgui"
)
) from e
start_dpgui(port=port, bind_all=bind_all)

Check warning on line 31 in deepmd/entrypoints/gui.py

View check run for this annotation

Codecov / codecov/patch

deepmd/entrypoints/gui.py#L31

Added line #L31 was not covered by tests

0 comments on commit bf5d6c3

Please sign in to comment.