Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw RuntimeError if no system is found by expand_sys_str #1292

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dpgen/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]:
-------
List[str]
list of string pointing to system directories

Raises
------
RuntimeError
No system was found in the directory
"""
root_dir = Path(root_dir)
if root_dir.is_dir():
Expand All @@ -66,6 +71,8 @@ def expand_sys_str(root_dir: Union[str, Path]) -> list[str]:
]
else:
raise OSError(f"{root_dir} does not exist.")
if len(matches) == 0:
raise RuntimeError("%s does not contain any systems!" % root_dir)
return matches


Expand Down