Skip to content

Commit 54080c1

Browse files
committed
Revert "make io detection work also for non-existant files"
This reverts commit 9204aa7.
1 parent 9e3172b commit 54080c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

neo/io/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def list_candidate_ios(file_or_folder, ignore_patterns=['*.ini', 'README.txt', '
429429
"""
430430
file_or_folder = pathlib.Path(file_or_folder)
431431

432-
if file_or_folder.suffix:
432+
if file_or_folder.is_file():
433433
suffix = file_or_folder.suffix[1:].lower()
434434
if suffix not in io_by_extension:
435435
raise ValueError(f'{suffix} is not a supported format of any IO.')
@@ -452,6 +452,12 @@ def list_candidate_ios(file_or_folder, ignore_patterns=['*.ini', 'README.txt', '
452452
# to select all files sharing the `session1-` prefix
453453
elif file_or_folder.parent.exists():
454454
filenames = file_or_folder.parent.glob(file_or_folder.name + '*')
455+
456+
elif file_or_folder.suffix:
457+
suffix = file_or_folder.suffix[1:].lower()
458+
if suffix not in io_by_extension:
459+
raise ValueError(f'{suffix} is not a supported format of any IO.')
460+
return io_by_extension[suffix]
455461

456462
else:
457463
raise ValueError(f'{file_or_folder} does not contain data files of a supported format')

0 commit comments

Comments
 (0)