Skip to content

Commit f3d98b3

Browse files
author
Thinh Nguyen
committed
try-catch for searching/loading spikeglx files
1 parent f9e5fc2 commit f3d98b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

elements_ephys/readers/spikeglx.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ def __init__(self, root_dir):
3737

3838
self.root_dir = pathlib.Path(root_dir)
3939

40-
meta_filepath = next(pathlib.Path(root_dir).glob('*.ap.meta'))
40+
try:
41+
meta_filepath = next(pathlib.Path(root_dir).glob('*.ap.meta'))
42+
except StopIteration:
43+
raise FileNotFoundError(f'No SpikeGLX file (.ap.meta) found at: {root_dir}')
44+
4145
self.root_name = meta_filepath.name.replace('.ap.meta', '')
4246

4347
@property

0 commit comments

Comments
 (0)