Remove automatic zero-padding when specifing run in BIDSPath()


I have an BIDS compatible dataset, which I want to load using BIDSPath.

bids_path = BIDSPath(subject=subject_id,session="01", task='act', run=1,
                     datatype='eeg', suffix='eeg',

This is the example naming for the files within the dataset:


Note there, that for run the 1 is specified. As in my code above I have specified run=1, so theoretically it should work. However mne-bids seems to add an automatic-zero padding for the run number and expects:


Now my questions is whether I have to rename all data within the dataset or do the filename encoding by myself. Or maybe there is an option were I can disable the zero padding.


  • mne 1.5.1
  • mne-bids 0.14

Thank you,

1 Like

Hello @carlo711 and welcome to the forum!
To me this seems like a problem we need to fix in MNE-BIDS. I don’t think there’s currently a workaround to avoid this problem, sorry.

You definitely shouldn’t have to rename your files.

@sappelhoff WDYT?

Best wishes,

yes, if we can replicate this issue, we should fix it! Could you please open an issue on the GitHub repo @carlo711?

just a thought, maybe specifying run as a str works: run='1'.

part of the reported behavior is also documented, see:

1 Like

Thank you the method with as string worked :slight_smile:
However I got the issue

Please use HDF reader for matlab v7.3 files, e.g. h5py

I resolved it by installing

pip install mat73
pip install pymatreader

This behavior will change with: Do not zero-pad indices in BIDSPath entities anymore; do not warn about prepending missing dots for extensions by alexrockhill · Pull Request #1215 · mne-tools/mne-bids · GitHub

most likely in mne_bids 0.15

1 Like