I have some eeg files from users in South America that use extended characters. When I try to open them with mnelab (0.8.5), I receiver an error message suggesting I should try encoding="latin1"
. That is what I do when using e.g. mne.io.read_raw.
What would be the best way to handle this for mnelab?
Thanks.
Full error message:
Traceback (most recent call last):
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mne/io/edf/edf.py", line 1623, in _read_annotations_edf
triggers = re.findall(pat, tals.decode(encoding))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe7 in position 287: invalid continuation byte
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mnelab/mainwindow.py", line 588, in open_data
self.model.load(fname)
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mnelab/model.py", line 36, in wrapper
f(*args, **kwargs)
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mnelab/model.py", line 110, in load
data = read_raw(fname, *args, **kwargs, preload=True)
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mnelab/io/readers.py", line 82, in read_raw
return readers[ext](fname, *args, **kwargs)
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mne/io/edf/edf.py", line 1412, in read_raw_edf
return RawEDF(input_fname=input_fname, eog=eog, misc=misc,
File "<decorator-gen-244>", line 12, in __init__
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mne/io/edf/edf.py", line 181, in __init__
onset, duration, desc = _read_annotations_edf(
File "/home/john/anaconda3/envs/neurogram/lib/python3.10/site-packages/mne/io/edf/edf.py", line 1625, in _read_annotations_edf
raise Exception(
Exception: Encountered invalid byte in at least one annotations channel. You might want to try setting "encoding='latin1'".