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

**URL:** <https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865>\
**Category:** Support & Discussions\
**Tags:** mne-bids\
**Created:** [November 17, 2023, 2:35pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865 "2023-11-17T14:35:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carlo711](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/carlo711/32/3195_2.png) [@carlo711](https://mne.discourse.group/u/carlo711)\
**Post date:** [November 17, 2023, 2:35pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/1 "2023-11-17T14:35:48Z")

</div>

Hello,

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

```python
bids_path = BIDSPath(subject=subject_id,session="01", task='act', run=1,
                     datatype='eeg', suffix='eeg',
                     root=bids_root,)

```

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

> sub-002\_ses-01\_task-act\_run-1\_eeg

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:

> sub-002\_ses-01\_task-act\_run- **01** \_eeg

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.

**Using**

- mne 1.5.1
- mne-bids 0.14

Thank you,  
carlo

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [November 17, 2023, 6:37pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/2 "2023-11-17T18:37:13Z")

</div>

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,  
Richard

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [November 17, 2023, 7:17pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/3 "2023-11-17T19:17:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [November 17, 2023, 8:55pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/4 "2023-11-17T20:55:08Z")

</div>

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

part of the reported behavior is also documented, see: [https://github.com/mne-tools/mne-bids/blob/781fc577dc0da0419f7eb5c40d537b51834cb802/mne\_bids/path.py#L879-L880](https://github.com/mne-tools/mne-bids/blob/781fc577dc0da0419f7eb5c40d537b51834cb802/mne_bids/path.py#L879-L880)

---

<div class="post-metadata">

**Author:** ![carlo711](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/carlo711/32/3195_2.png) [@carlo711](https://mne.discourse.group/u/carlo711)\
**Post date:** [November 18, 2023, 4:59pm UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/5 "2023-11-18T16:59:58Z")

</div>

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

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

```

I resolved it by installing

```python
pip install mat73
pip install pymatreader

```

---

<div class="post-metadata">

**Author:** ![sappelhoff](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/sappelhoff/32/3276_2.png) [@sappelhoff](https://mne.discourse.group/u/sappelhoff)\
**Post date:** [February 22, 2024, 10:37am UTC](https://mne.discourse.group/t/remove-automatic-zero-padding-when-specifing-run-in-bidspath/7865/6 "2024-02-22T10:37:14Z")

</div>

> [@carlo711](#):
>
> However mne-bids seems to add an automatic-zero padding for the run number and expects

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](https://github.com/mne-tools/mne-bids/pull/1215)

most likely in mne\_bids 0.15
