Skip to content

Commit 3cbb019

Browse files
handle datalad 0.15 exceptions from require_dataset
1 parent c5f265c commit 3cbb019

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

datalad_metalad/utils.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,20 @@ def check_dataset(dataset_or_path: Union[Dataset, str],
4646
if isinstance(dataset_or_path, Dataset):
4747
dataset = dataset_or_path
4848
else:
49-
dataset = require_dataset(
50-
dataset_or_path,
51-
purpose=purpose,
52-
check_installed=True)
49+
try:
50+
dataset = require_dataset(
51+
dataset_or_path,
52+
purpose=purpose,
53+
check_installed=True)
54+
except ValueError as ve:
55+
# This except clause translates datalad version 0.15 exceptions to
56+
# datalad version 0.16 exceptions
57+
if ve.args and ve.args[0].startswith("No installed dataset found "):
58+
raise NoDatasetFound(
59+
"No valid datalad dataset found at: "
60+
f"{dataset_or_path}")
61+
else:
62+
raise
5363

5464
if not dataset.repo:
5565
raise NoDatasetFound(

0 commit comments

Comments
 (0)