import os
import numpy as np
import mne
data_folder = '/Users/sheetal/Desktop/emotions'
data_raw_file = os.path.join(data_folder,"sub-01","eeg","sub-01_task-ImaginedEmotion_eeg.set")
raw = mne.io.read_raw_eeglab(data_raw_file)
OUTPUT
runfile('/Users/sheetal/Desktop/emotions/sub-01/eeg/code1.py', wdir='/Users/sheetal/Desktop/emotions/sub-01/eeg')
Traceback (most recent call last):
File "/Users/sheetal/Desktop/emotions/sub-01/eeg/code1.py", line 15, in <module>
raw = mne.io.read_raw_eeglab(data_raw_file)
File "/Users/sheetal/opt/anaconda3/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 219, in read_raw_eeglab
return RawEEGLAB(input_fname=input_fname, preload=preload,
File "<decorator-gen-222>", line 24, in __init__
File "/Users/sheetal/opt/anaconda3/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 317, in __init__
eeg = _check_load_mat(input_fname, uint16_codec)
File "/Users/sheetal/opt/anaconda3/lib/python3.8/site-packages/mne/io/eeglab/eeglab.py", line 59, in _check_load_mat
eeg = read_mat(fname, uint16_codec=uint16_codec)
File "/Users/sheetal/opt/anaconda3/lib/python3.8/site-packages/mne/externals/pymatreader/pymatreader.py", line 78, in read_mat
raise IOError('The file %s does not exist.' % (filename,))
OSError: The file /Users/sheetal/Desktop/emotions/sub-01/eeg/sub-01_task-ImaginedEmotion_eeg.set does not exist.
I am new to use MNE python package for EEG signal processing and getting error reading .set file
I occasionally encounter this problem.
The .set & corresponding .fdt files are actually there, but unfortunately MNE cannot read those files, resulting in file not found error.
It seemed that the issue is related to the generating files from the EEGLab, which, due to its unstable development, often produce a lot of errors.
Suggestion: re-generating those files from EEGLab.
UPDATE
Currently, I found that my problem is relating to the uncompatible version of EEGLab and Python-MNE.
Previously, I used EEGLab 2019.1 to generate .set files and Python-MNE 0.20.4 to read those files.
Later, EEGLab released the latest version 2021.1 and disable 2019.1 which forced us to use the latest one.
The problems arrive when I used the EEGLab 2021.1 with MNE 0.20.4 which doesn't support the latest version of EEGLab.
Updating MNE to the latest 0.23.4 solves my issue.