Skip to content

Commit ae86e0e

Browse files
author
sprenger
committed
[neuralynx] improve error messages
1 parent 0877165 commit ae86e0e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

neo/rawio/neuralynxrawio/neuralynxrawio.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ def _parse_header(self):
114114
filenames = sorted(os.listdir(self.dirname))
115115
dirname = self.dirname
116116
else:
117+
if not os.path.isfile(self.filename):
118+
raise ValueError(f'Provided Filename is not a file: '
119+
f'{self.filename}. If you want to provide a '
120+
f'directory use the `dirname` keyword')
121+
117122
dirname, fname = os.path.split(self.filename)
118123
filenames = [fname]
119124

@@ -581,8 +586,8 @@ def scan_ncs_files(self, ncs_filenames):
581586
# If there is only one NcsSections structure in the set of ncs files, there should only
582587
# be one entry. Otherwise this is presently unsupported.
583588
if len(revSectMap) > 1:
584-
raise IOError('ncs files have {} different sections structures. Unsupported.'.format(
585-
len(revSectMap)))
589+
raise IOError(f'ncs files have {len(revSectMap)} different sections '
590+
f'structures. Unsupported configuration.')
586591

587592
seg_time_limits = SegmentTimeLimits(nb_segment=len(lastNcsSections.sects),
588593
t_start=[], t_stop=[], length=[],

0 commit comments

Comments
 (0)