# Issue with mne.io.read\_raw\_eeglab in EEGLAB File Loading

**URL:** <https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749>\
**Category:** Support & Discussions\
**Created:** [January 28, 2025, 2:12am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749 "2025-01-28T02:12:45Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![balandongiv](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/balandongiv/32/104_2.png) [@balandongiv](https://mne.discourse.group/u/balandongiv)\
**Post date:** [January 28, 2025, 2:12am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/1 "2025-01-28T02:12:45Z")

</div>

I’m encountering an issue while trying to load an EEGLAB `.set` file using `mne.io.read_raw_eeglab`. Here’s the relevant code snippet:

```python
import mne

file_path = "s01_061102n.set"
raw = mne.io.read_raw_eeglab(file_path, preload=True)

```

When I run this, I receive the following error:

```python
Traceback (most recent call last):
  File "main.py", line 8, in <module>
    raw = mne.io.read_raw_eeglab(file_path, preload=True)
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 328, in read_raw_eeglab
    return RawEEGLAB(
  File "<decorator-gen-267>", line 12, in __init__
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 459, in __init__
    info, eeg_montage, _ = _get_info(eeg, eog=eog, montage_units=montage_units)
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 230, in _get_info
    ch_names, ch_types, eeg_montage = _get_montage_information(
  File "...\site-packages\mne\io\eeglab\eeglab.py", line 165, in _get_montage_information
    if hasattr(eeg, "chaninfo") and isinstance(eeg.chaninfo["nodatchans"], dict):
KeyError: 'nodatchans'

Process finished with exit code 1

```

The error seems to be caused by the absence of the `chaninfo["nodatchans"]` key in the data structure. May I know if there is a way to bypass or handle the missing `chaninfo["nodatchans"]` key to successfully load the file?

The dataset I’m working with includes EEG signals obtained using the **Scan SynAmps2 Express system** (Compumedics Ltd., VIC, Australia). The signals were recorded using a wired EEG cap with **32 Ag/AgCl electrodes** , including 30 EEG electrodes and 2 reference electrodes (opposite lateral mastoids). These details are provided in the dataset’s README file.

The specific file used in this example can be downloaded here: [figshare](https://figshare.com/ndownloader/files/11821322).

---

<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 28, 2025, 5:55am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/2 "2025-01-28T05:55:06Z")

</div>

It seems like you’re hitting an issue that I thought had been resolved (but apparently it still exists), see some discussion [here](https://github.com/mne-tools/mne-python/issues/11641). There’s [another forum post](https://mne.discourse.group/t/can-not-read-set-file-getting-nodatchans-keyerror/8233) with the same problem, which states that importing used to work with MNE 1.5.1 (and we never followed up on that unfortunately). @larsoner @drammock do you remember if we fixed that issue, or should we open a new one?

---

<div class="post-metadata">

**Author:** ![larsoner](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/larsoner/32/3_2.png) [@larsoner](https://mne.discourse.group/u/larsoner)\
**Post date:** [January 28, 2025, 4:55pm UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/3 "2025-01-28T16:55:47Z")

</div>

That line appears to exist:

> <https://github.com/mne-tools/mne-python/blob/45fb777fbc53c88888032d40a14940c985079a93/mne/io/eeglab/eeglab.py#L165>

We probably need to adjust the check. Worth opening a new issue I think!

---

<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 29, 2025, 3:11pm UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/4 "2025-01-29T15:11:45Z")

</div>

Thanks @larsoner! I agree it might be worth doing e.g. `isinstance(eeg.chaninfo.get("nodatchans"), dict)` or similar instead, but @balandongiv can you post the output of `mne.sys_info()` just in case?

---

<div class="post-metadata">

**Author:** ![balandongiv](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/balandongiv/32/104_2.png) [@balandongiv](https://mne.discourse.group/u/balandongiv)\
**Post date:** [January 31, 2025, 12:53pm UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/5 "2025-01-31T12:53:34Z")

</div>

Thanks for the response @cbrnr ,

May I know if I should open new `issue` in "Github`?

as requested, here is the output for `mne.sys_info()`

```python

 + mne 1.9.0 (latest release)
 + numpy 2.2.1 (OpenBLAS 0.3.28 with 24 threads)
 + scipy 1.15.1
 + matplotlib 3.10.0 (backend=tkagg)

Numerical (optional)
 + sklearn 1.6.1
 + pandas 2.2.3
 - unavailable numba, nibabel, nilearn, dipy, openmeeg, cupy, h5io, h5py

Visualization (optional)
 - unavailable pyvista, pyvistaqt, vtk, qtpy, ipympl, pyqtgraph, mne-qt-browser, ipywidgets, trame_client, trame_server, trame_vtk, trame_vuetify

Ecosystem (optional)
 - unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo, eeglabio, edfio, mffpy, pybv
None

```

---

<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:** [February 1, 2025, 10:03am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/6 "2025-02-01T10:03:43Z")

</div>

Thanks @balandongiv. Yes, please open an issue, and if possible, share the problematic file with us there.

---

<div class="post-metadata">

**Author:** ![balandongiv](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/balandongiv/32/104_2.png) [@balandongiv](https://mne.discourse.group/u/balandongiv)\
**Post date:** [February 2, 2025, 12:58pm UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/7 "2025-02-02T12:58:42Z")

</div>

Done log the [bug](https://github.com/mne-tools/mne-python/issues/13094#issue-2825788649).

Thanks for your time responding on this thread.

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [February 4, 2025, 11:45am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/8 "2025-02-04T11:45:39Z")

</div>

This has been fixed in the MNE-Python development version and will be included in the next release.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [February 11, 2025, 11:46am UTC](https://mne.discourse.group/t/issue-with-mne-io-read-raw-eeglab-in-eeglab-file-loading/10749/9 "2025-02-11T11:46:27Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
