FileNotFoundError while using `read_raw_brainvision`, since `.vmrk` file name was changed

  • MNE version: 1.0.3
  • operating system: Windows 11
import mne
import os

os.chdir('data')
datapath = "sub-032301.vhdr"
raw = mne.io.read_raw_brainvision(datapath)

Hi, I want to read a recording using the code above and get the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'c:\\Users\\...\\data\\sub-010002.vmrk'

With isfile(datapath) I do get True.
And in the same data folder I have the file sub-032301.vmrk, but somehow the function is looking for a .vmrk with changed name… Does anyone have the same problem?

The files were probably renamed, which is not a good idea, because references break as in the case you’re witnessing here.

You can open the .vhdr file in a text editor and search for DataFile= and MarkerFile=. Their values need to be updated to match the new filenames. Change the values accordingly and save the file, and then read_raw_brainvision() should work again.

Best wishes,
Richard

Thanks a lot for the swift reply! I changed the two parameters in the .vhdr accordingly, indeed I can read the data now :+1:

1 Like