Skip to content

Commit 4c473d1

Browse files
authored
Merge pull request #3170 from h-mayorquin/better_error_in_load
Better error message for `BaseExtractor.load()`
2 parents cdf84b4 + bc36abe commit 4c473d1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/spikeinterface/core/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ def load(file_path: Union[str, Path], base_folder: Optional[Union[Path, str, boo
765765
if "warning" in d:
766766
print("The extractor was not serializable to file")
767767
return None
768+
768769
extractor = BaseExtractor.from_dict(d, base_folder=base_folder)
769770
return extractor
770771

@@ -797,7 +798,11 @@ def load(file_path: Union[str, Path], base_folder: Optional[Union[Path, str, boo
797798
return extractor
798799

799800
else:
800-
raise ValueError("spikeinterface.Base.load() file_path must be an existing folder or file")
801+
error_msg = (
802+
f"{file_path} is not a file or a folder. It should point to either a json, pickle file or a "
803+
"folder that is the result of extractor.save(...)"
804+
)
805+
raise ValueError(error_msg)
801806

802807
def __reduce__(self):
803808
"""

0 commit comments

Comments
 (0)