BIDSPath creating new directory when specified dir doesn't exist!

Hi all,

I am setting the path to the individual subject meg directory with mne_bids.BIDSPath. However, I noticed that if the subject does not yet have a BIDS meg directory (I am a BIDS newbie and my group is still in the process of BIDsifying all subject data), BIDSPath will automatically create an empty meg directory (which I do not want)!

I looked through the documentation and did not see any arguments that could be used to avoid this within BIDSPath. Any suggestions on what to do besides adding additional code to preemptively check if the path exists?

Many thanks,

Hi Kaya, what’s your usecase to not have BIDSPath create a directory that should be there in the first place (if you are inquiring for it)?

I think this is the part in the sourcecode where the directory gets created:

@sappelhoff I would claim that creating a directory if the user is not explicitly requesting to write something should be considered a bug


I have been encountering the same problem! Let’s say I accidentally type in the wrong subject name when creating my BIDSPath(). Now my BIDS directory is contaminated with an empty subject directory of a subject who was only a typo. Instead, I think that it should notify the user if a path does not exist.


I’m working on a fix:


@richard thank you very much!

1 Like

This problem will be fixed in MNE-BIDS 0.13