Skip to content

Bug: bids_preproc() on a single .edf fails due to README.md in montages directory #26

Closed

Description

@Fordulation

eegprep.bids_preproc() throws a ValueError when processing EDF files because it attempts to validate all files in the resources/montages/ directory as .locs files, including the documentation README.md file that ships with the package.

Traceback (most recent call last):
  File "/opt/miniforge3/envs/nbai_preproc/lib/python3.12/site-packages/eegprep/bids_preproc.py", line 569, in bids_preproc
    EEG, import_report = pop_load_frombids(...)
  File "/opt/miniforge3/envs/nbai_preproc/lib/python3.12/site-packages/eegprep/pop_load_frombids.py", line 884, in pop_load_frombids
    raise ValueError(f"Only montage files with the .locs extension are supported, "
                     f"but found {filename}. These are MATLAB v7 .mat files; "
                     f"please convert your montage into the appropriate format.")
ValueError: Only montage files with the .locs extension are supported, but found README.md.
These are MATLAB v7 .mat files; please convert your montage into the appropriate format.

in eegprep/pop_load_frombids.py :

# Determine montage path and files to check
montage_path = os.path.join(os.path.dirname(__file__), 'resources', 'montages')

# ... (path validation code)

else:
    # Use all available montage files
    filenames = sorted(os.listdir(montage_path))

for filename in filenames:
    if not filename.endswith('.locs'):
        raise ValueError(f"Only montage files with the .locs extension are supported, "
                         f"but found {filename}. These are MATLAB v7 .mat files; "
                         f"please convert your montage into the appropriate format.")

The issue: the code lists all files in the montages directory including README.md, then raises the error because the README is not a .locs file.

Potential Fix:

Filter for .locs files instead of raising an error on non-.locs files:

Temp Workaround:

Remove the README.md from the montages directory:

Activity

  1. arnodelorme commented on Nov 20, 2025

    @arnodelorme
    Collaborator

    Fixed in d5ad950
    Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions