# Can not read .set file getting 'nodatchans' keyerror

**URL:** <https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233>\
**Category:** Support & Discussions\
**Tags:** eeg\
**Created:** [January 30, 2024, 11:56am UTC](https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233 "2024-01-30T11:56:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAIHANRABBY](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/raihanrabby/32/3090_2.png) [@RAIHANRABBY](https://mne.discourse.group/u/RAIHANRABBY)\
**Post date:** [January 30, 2024, 11:56am UTC](https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233/1 "2024-01-30T11:56:18Z")

</div>

- MNE version: 1.6.1
- operating system: Windows 10

**📄 code:  
raw = mne.io.read\_raw\_eeglab(file, preload = False)**

🖋I’m getting this error and don’t know how to solve it. I have tried reinstalling the dependency as given in mne-tools site. but still it gives the below error.

```python
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
Cell In[13], line 1
----> 1 raw = mne.io.read_raw_eeglab(file, preload = False)

File ~\anaconda3\envs\mneeeglab\Lib\site-packages\mne\io\eeglab\eeglab.py:332, in read_raw_eeglab(input_fname, eog, preload, uint16_codec, montage_units, verbose)
    288 @fill_doc
    289 def read_raw_eeglab(
    290 input_fname,
   (...)
    295 verbose=None,
    296 ):
    297 r"""Read an EEGLAB .set file.
    298 
    299 Parameters
   (...)
    330 .. versionadded:: 0.11.0
    331 """
--> 332 return RawEEGLAB(
    333 input_fname=input_fname,
    334 preload=preload,
    335 eog=eog,
    336 uint16_codec=uint16_codec,
    337 montage_units=montage_units,
    338 verbose=verbose,
    339 )

File <decorator-gen-237>:12, in __init__ (self, input_fname, eog, preload, uint16_codec, montage_units, verbose)

File ~\anaconda3\envs\mneeeglab\Lib\site-packages\mne\io\eeglab\eeglab.py:463, in RawEEGLAB. __init__ (self, input_fname, eog, preload, uint16_codec, montage_units, verbose)
    456 raise TypeError(
    457 "The number of trials is %d. It must be 1 for raw"
    458 " files. Please use `mne.io.read_epochs_eeglab` if"
    459 " the .set file contains epochs." % eeg.trials
    460 )
    462 last_samps = [eeg.pnts - 1]
--> 463 info, eeg_montage, _ = _get_info(eeg, eog=eog, montage_units=montage_units)
    465 # read the data
    466 if isinstance(eeg.data, str):

File ~\anaconda3\envs\mneeeglab\Lib\site-packages\mne\io\eeglab\eeglab.py:234, in _get_info(eeg, eog, montage_units)
    232 if eeg_has_ch_names_info:
    233 has_pos = _eeg_has_montage_information(eeg)
--> 234 ch_names, ch_types, eeg_montage = _get_montage_information(
    235 eeg, has_pos, montage_units=montage_units
    236 )
    237 update_ch_names = False
    238 else: # if eeg.chanlocs is empty, we still need default chan names

File ~\anaconda3\envs\mneeeglab\Lib\site-packages\mne\io\eeglab\eeglab.py:169, in _get_montage_information(eeg, get_pos, montage_units)
    158 warn(
    159 "Unknown types found, setting as type EEG:\n"
    160 + "\n".join(
   (...)
    165 )
    166 )
    168 lpa, rpa, nasion = None, None, None
--> 169 if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo["nodatchans"], dict):
    170 nodatchans = eeg.chaninfo["nodatchans"]
    171 types = nodatchans.get("type", [])

KeyError: 'nodatchans'

```

---

<div class="post-metadata">

**Author:** ![cbrnr](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/cbrnr/32/1409_2.png) [@cbrnr](https://mne.discourse.group/u/cbrnr)\
**Post date:** [January 30, 2024, 12:46pm UTC](https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233/2 "2024-01-30T12:46:22Z")

</div>

Do you know if EEGLAB can read this file?

---

<div class="post-metadata">

**Author:** ![RAIHANRABBY](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/raihanrabby/32/3090_2.png) [@RAIHANRABBY](https://mne.discourse.group/u/RAIHANRABBY)\
**Post date:** [January 30, 2024, 3:54pm UTC](https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233/3 "2024-01-30T15:54:06Z")

</div>

Yes. It worked for me in mne version 1.5.1. when I updated the version of mne it gave is error.
