Skip to content

Commit 2fe8b2c

Browse files
committed
Raise an error if no ringmodes found
1 parent 3a39b20 commit 2fe8b2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pytac/load_csv.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ def available_ringmodes(directory=None) -> Set[str]:
280280
is given the default data directory location is used.
281281
282282
Returns:
283-
set: A set of possible ringmodes.
283+
set[str]: A set of possible ringmodes.
284+
285+
Raises:
286+
OSError: if no ringmodes can be found in the specified directory.
284287
"""
285288
if directory is None:
286289
directory = Path(__file__).resolve().parent / "data"
@@ -290,4 +293,6 @@ def available_ringmodes(directory=None) -> Set[str]:
290293
contents = os.listdir(directory_object.path)
291294
if ELEMENTS_FILENAME in contents and FAMILIES_FILENAME in contents:
292295
modes.add(directory_object.name)
296+
if not modes:
297+
raise OSError(f"No ringmodes found in {os.path.realpath(directory)}")
293298
return modes

0 commit comments

Comments
 (0)