# can't import my set file using read\_epochs\_eeglab()

**URL:** <https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718>\
**Category:** Support & Discussions\
**Tags:** data-import\
**Created:** [April 14, 2023, 1:11pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718 "2023-04-14T13:11:44Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![HSUkin](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/hsukin/32/2441_2.png) [@HSUkin](https://mne.discourse.group/u/HSUkin)\
**Post date:** [April 14, 2023, 1:11pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/1 "2023-04-14T13:11:44Z")

</div>

```python
import os
import mne
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
os.chdir("D:/222experiment_material/EEG_DATA")
print(os.getcwd())
file_path = './practice/hulike/data/MC_H01.set'
raw = mne.read_epochs_eeglab(file_path)
print(raw.info)

```

```python
TypeError Traceback (most recent call last)
Cell In[4], line 2
      1 
----> 2 raw = mne.read_epochs_eeglab(file_path)

File D:\Python\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py:337, in read_epochs_eeglab(input_fname, events, event_id, eog, uint16_codec, montage_units, verbose)
    288 @fill_doc
    289 def read_epochs_eeglab(input_fname, events=None, event_id=None,
    290 eog=(), *, uint16_codec=None, montage_units='mm',
    291 verbose=None):
    292 r"""Reader function for EEGLAB epochs files.
    293 
    294 Parameters
   (...)
    335 .. versionadded:: 0.11.0
    336 """
--> 337 epochs = EpochsEEGLAB(input_fname=input_fname, events=events, eog=eog,
    338 event_id=event_id, uint16_codec=uint16_codec,
    339 montage_units=montage_units, verbose=verbose)
    340 return epochs

File <decorator-gen-296>:12, in __init__ (self, input_fname, events, event_id, tmin, baseline, reject, flat, reject_tmin, reject_tmax, eog, uint16_codec, montage_units, verbose)

File D:\Python\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py:569, in EpochsEEGLAB. __init__ (self, input_fname, events, event_id, tmin, baseline, reject, flat, reject_tmin, reject_tmax, eog, uint16_codec, montage_units, verbose)
    567 logger.info('Extracting parameters from %s...' % input_fname)
    568 scale_units = _handle_montage_units(montage_units)
--> 569 info, eeg_montage, _ = _get_info(eeg, eog=eog, scale_units=scale_units)
    571 for key, val in event_id.items():
    572 if val not in events[:, 2]:

File D:\Python\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py:199, in _get_info(eeg, eog, scale_units)
    196 if eeg_has_ch_names_info:
    197 has_pos = _eeg_has_montage_information(eeg)
    198 ch_names, ch_types, eeg_montage = \
--> 199 _get_montage_information(eeg, has_pos, scale_units=scale_units)
    200 update_ch_names = False
    201 else: # if eeg.chanlocs is empty, we still need default chan names

File D:\Python\Anaconda3\lib\site-packages\mne\io\eeglab\eeglab.py:150, in _get_montage_information(eeg, get_pos, scale_units)
    148 lpa, rpa, nasion = None, None, None
    149 if hasattr(eeg, "chaninfo") and len(eeg.chaninfo.get('nodatchans', [])):
--> 150 for item in list(zip(*eeg.chaninfo['nodatchans'].values())):
    151 d = dict(zip(eeg.chaninfo['nodatchans'].keys(), item))
    152 if d.get("type", None) != 'FID':

TypeError: 'int' object is not iterable

```

My document can be read in MATLAB without any issues, it is likely that there are no problems with it.

---

<div class="post-metadata">

**Author:** ![lucas](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lucas](https://mne.discourse.group/u/lucas)\
**Post date:** [April 20, 2023, 3:11am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/2 "2023-04-20T03:11:26Z")

</div>

I also can’t run my code in this error, do you have solved this error?If you solve it, I want to learn with you !  
best,

---

<div class="post-metadata">

**Author:** ![Eliteria](https://avatars.discourse-cdn.com/v4/letter/e/779978/32.png) [@Eliteria](https://mne.discourse.group/u/Eliteria)\
**Post date:** [April 20, 2023, 8:35am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/3 "2023-04-20T08:35:02Z")

</div>

**I do have this problem too!!!** and the message is also **TypeError: ‘int’ object is not iterable** when I try to use the `mne.io.read_epochs_eeglab()` to load my .set file generated by eeglab.  
and my OS is MacOS 12.5.1, the python version is 3.9.16, mne version is 1.3.1.  
At first, I thought it might be my M1 pro problem, but when I use the window10 as OS, it also produces this wrong message.  
If You have solved this problem, I want to learn it too!  
Best regards,

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 20, 2023, 7:18pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/4 "2023-04-20T19:18:23Z")

</div>

@richard hi! This seems like a big issue for multiple users. Any opinions?

---

<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:** [April 20, 2023, 8:20pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/5 "2023-04-20T20:20:16Z")

</div>

I’m not familiar with EEGLAB file reading.

I suppose an example file would be required for debugging…

---

<div class="post-metadata">

**Author:** ![lucas](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@lucas](https://mne.discourse.group/u/lucas)\
**Post date:** [April 21, 2023, 5:37am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/6 "2023-04-21T05:37:02Z")

</div>

yes, I also have the problem too!!

---

<div class="post-metadata">

**Author:** ![Eliteria](https://avatars.discourse-cdn.com/v4/letter/e/779978/32.png) [@Eliteria](https://mne.discourse.group/u/Eliteria)\
**Post date:** [April 24, 2023, 8:00am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/7 "2023-04-24T08:00:44Z")

</div>

Hi, I have the .set file with problems, If you need it, I can send it to you. by email or some other way.

---

<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:** [April 24, 2023, 8:44am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/8 "2023-04-24T08:44:59Z")

</div>

I won’t have time to look into this, but maybe someone else will 👍

---

<div class="post-metadata">

**Author:** ![dasdiptyajit](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/dasdiptyajit/32/4796_2.png) [@dasdiptyajit](https://mne.discourse.group/u/dasdiptyajit)\
**Post date:** [April 24, 2023, 9:44am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/9 "2023-04-24T09:44:15Z")

</div>

@Eliteria I think the issue was already reported a couple of days before.  
You can follow the following post for more updates:

> <https://github.com/mne-tools/mne-python/issues/11641>
>
> \### Description of the problem
> 
> I get the error: “TypeError: ‘int’ object is not… iterable”.I am not sure where I could be making a mistake.
> 
> 
> \### Steps to reproduce
> 
> \`\`\`Python
> these are my codes:
> import mne
> import numpy as np
> import matplotlib.pyplot as plt
> from scipy import stats
> import pickle
> import pymatreader
> import mffpy
> \#single sub evoked
> eeg1 = mne.io.read\_epochs\_eeglab(‘1\_LH.set’)
> \`\`\`
> 
> 
> \### Link to data
> 
> \_No response\_
> 
> \### Expected results
> 
> how to solve the problem
> 
> \### Actual results
> 
> eeg1 = mne.io.read\_epochs\_eeglab('1\_LH.set')
> Extracting parameters from E:\\code\\EEG ML code\\EEG\\part2\\2\_extra\_features\\Example\_data\\1\_LH.set...
> Traceback (most recent call last):
> 
> File "C:\\Users\\Administrator\\AppData\\Local\\Temp/ipykernel\_17044/1102068857.py", line 1, in \<module\>
> eeg1 = mne.io.read\_epochs\_eeglab('1\_LH.set')
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 337, in read\_epochs\_eeglab
> epochs = EpochsEEGLAB(input\_fname=input\_fname, events=events, eog=eog,
> 
> File "\<decorator-gen-296\>", line 12, in \_\_init\_\_
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 569, in \_\_init\_\_
> info, eeg\_montage, \_ = \_get\_info(eeg, eog=eog, scale\_units=scale\_units)
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 199, in \_get\_info
> \_get\_montage\_information(eeg, has\_pos, scale\_units=scale\_units)
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 150, in \_get\_montage\_information
> for item in list(zip(\*eeg.chaninfo\['nodatchans'\].values())):
> 
> TypeError: 'int' object is not iterable
> 
> \### Additional information
> 
> my mne version is 1.3.1
> windows 11

best,  
Dip

---

<div class="post-metadata">

**Author:** ![vdebenay](https://avatars.discourse-cdn.com/v4/letter/v/5e9695/32.png) [@vdebenay](https://mne.discourse.group/u/vdebenay)\
**Post date:** [May 23, 2023, 4:29pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/10 "2023-05-23T16:29:26Z")

</div>

Hello everyone,

I also get an error when I try to read a .set EEGLAB file using the mne.io.read\_epochs\_eeglab() reader. However, the error message I get differs from the one @HSUkin, @lucas, and @Eliteria face.

My script:

```python
import mne
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

filepath = "C:\Dev\DATA\Data_Marseille_RECOGNISENS_EPOCHED\ECV10\ECV10_WM_0.5_prepline_dessins_BR_clean_FIX.set"
EOG_channels = ("EXG1", "EXG2", "EXG4", "EXG5")
excluded_channels = ("EXG3", "EXG8", "EXG6", "EXG7")
test = mne.io.read_epochs_eeglab(filepath, eog=EOG_channels, verbose=True)

```

The error message I get:

```python
In [3]: runcell(1, 'C:/Dev/Python/Renorm/PyRenorm_Biosemi64_Marseille_WholeBrain_EPOCHEDdata.py')
Traceback (most recent call last):

  File C:\ProgramData\Anaconda3\envs\mne\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\dev\python\renorm\pyrenorm_biosemi64_marseille_wholebrain_epocheddata.py:79
    test = mne.io.read_epochs_eeglab(filepath, eog=EOG_channels, verbose=True)

  File C:\ProgramData\Anaconda3\envs\mne\lib\site-packages\mne\io\eeglab\eeglab.py:377 in read_epochs_eeglab
    epochs = EpochsEEGLAB(

  File <decorator-gen-306>:10 in __init__

  File C:\ProgramData\Anaconda3\envs\mne\lib\site-packages\mne\io\eeglab\eeglab.py:644 in __init__
    events[idx, 0] = event_latencies[idx]

IndexError: list index out of range

```

A sample of the “eeglab.py” file around line 644:

```python
            # now fill up the event array
            events = np.zeros((eeg.trials, 3), dtype=int)
            for idx in range(0, eeg.trials):
                if idx == 0:
                    prev_stim = 0
                elif idx > 0 and event_latencies[idx] - event_latencies[idx - 1] == 1:
                    prev_stim = event_id[event_name[idx - 1]]
                events[idx, 0] = event_latencies[idx]
                events[idx, 1] = prev_stim
                events[idx, 2] = event_id[event_name[idx]]
        elif isinstance(events, (str, Path, PathLike)):
            events = read_events(events)

```

Unfortunately, I cannot share with everyone the data I am working with. if @richard or anyone else has some time to look into this, I can temporarily share my .set file by email with them.  
Thank you for your time.

- MNE version: 1.4.0
- OS: Windows 11

Best regards,  
Valentin

---

<div class="post-metadata">

**Author:** ![rahulvenugopal](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rahulvenugopal/32/2765_2.png) [@rahulvenugopal](https://mne.discourse.group/u/rahulvenugopal)\
**Post date:** [June 19, 2023, 6:31pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/11 "2023-06-19T18:31:02Z")

</div>

Hello,  
I had a similar issue because of the way EEGLAB deals with events. Listing some troubleshooting options

1. Open the set file in EEGLAB and see if EEG.event is empty
2. Such situations can happen when you epoch in EEGLAB avoiding the marker time point, say

> EEG = pop\_epoch( EEG, {‘S101’}, …  
> [5 55], …  
> ‘newname’, ‘eeg\_data\_epochs’, ‘epochinfo’, ‘yes’);

I circumvented this issue by creating dummy EEG.event and EEG.epoch. I traced out the error by running eeg\_checkset(EEG) and realised the EEG.event was missing an epoch field as well.  
You may also look up this [issue](https://github.com/mne-tools/mne-python/issues/6610)

---

<div class="post-metadata">

**Author:** ![HSUkin](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/hsukin/32/2441_2.png) [@HSUkin](https://mne.discourse.group/u/HSUkin)\
**Post date:** [June 20, 2023, 3:03am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/13 "2023-06-20T03:03:05Z")

</div>

Thanks!  
But I would like to confirm if this is considered as EEG.event being empty?

 ![111](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/b/b087d1eaf6457c13bbda31eb6fb209cc6d5b7b37.png)

---

<div class="post-metadata">

**Author:** ![rahulvenugopal](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/rahulvenugopal/32/2765_2.png) [@rahulvenugopal](https://mne.discourse.group/u/rahulvenugopal)\
**Post date:** [June 20, 2023, 4:28am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/14 "2023-06-20T04:28:13Z")

</div>

It seems you do have event structure. Could you please check if there is a label called epoch inside the EEG.event structure?  
You can also do a eeg\_checkset(EEG) in MATLAB and see if you catch any errors

 ![Screenshot_2023-06-20-09-55-01-243_org.mozilla.firefox](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/4/4d1bf4e29fd8e9e6c4fa70d517c7c779a94caa60.jpeg)

I was getting an error because the EEG.event was not having epoch field. I wrote a small script to update the EEG.event and EEG.epoch and then saved the .set epoched files and those opened without any errors on MNE.

You can also epoch with timings 0 200 and see if same issue is happening. It should not since you have the marker

---

<div class="post-metadata">

**Author:** ![HSUkin](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/hsukin/32/2441_2.png) [@HSUkin](https://mne.discourse.group/u/HSUkin)\
**Post date:** [June 20, 2023, 6:27am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/16 "2023-06-20T06:27:48Z")

</div>

I just used eeg\_checkset(EEG) and it seems there are no errors.

 ![屏幕截图 2023-06-20 142216](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/f/fb4a73703f7a4c67f2de80bd3ae6c58f81650085.png)

And, I guess there should be no problem with EEG.event

 ![image](https://global.discourse-cdn.com/free1/uploads/mne/original/2X/b/b6643d13b6da9d8385a5b087b571b45c2371f18a.png)

---

<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:** [June 20, 2023, 7:10am UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/17 "2023-06-20T07:10:52Z")

</div>

It seems like there are multiple different problems regarding reading epoched EEGLAB data. To make it easier for developers track down and fix them, please open separate issues for each problem in our GitHub repository. Note that without specific files that demonstrate the problems, it will be very difficult to solve these issues, so please try and share some small dataset that cannot be imported with MNE.

---

<div class="post-metadata">

**Author:** ![gergo-szabo](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/gergo-szabo/32/3143_2.png) [@gergo-szabo](https://mne.discourse.group/u/gergo-szabo)\
**Post date:** [November 1, 2023, 9:11pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/18 "2023-11-01T21:11:43Z")

</div>

Not a small dataset, but it’s easy to download one example for demonstration (eg.: sub-008): [OpenNeuro](https://openneuro.org/datasets/ds003655)

---

<div class="post-metadata">

**Author:** ![drammock](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/drammock/32/4_2.png) [@drammock](https://mne.discourse.group/u/drammock)\
**Post date:** [November 1, 2023, 9:15pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/19 "2023-11-01T21:15:21Z")

</div>

> [@gergo-szabo](#):
>
> Not a small dataset, but it’s easy to download one example for demonstration (eg.: sub-008)

as @cbrnr said above, please open separate issues for each problem in our GitHub repository. If there is a problem with ds003655 subject 008, please open a GitHub issue with a link to that file and a description of what goes wrong when you try to open it, and complete sample code that will recreate the error for anyone trying to replicate it.

---

<div class="post-metadata">

**Author:** ![gergo-szabo](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/gergo-szabo/32/3143_2.png) [@gergo-szabo](https://mne.discourse.group/u/gergo-szabo)\
**Post date:** [November 1, 2023, 9:22pm UTC](https://mne.discourse.group/t/cant-import-my-set-file-using-read-epochs-eeglab/6718/20 "2023-11-01T21:22:00Z")

</div>

There is an existing issue (unfortunetly no progress since April)

> <https://github.com/mne-tools/mne-python/issues/11641>
>
> \### Description of the problem
> 
> I get the error: “TypeError: ‘int’ object is not… iterable”.I am not sure where I could be making a mistake.
> 
> 
> \### Steps to reproduce
> 
> \`\`\`Python
> these are my codes:
> import mne
> import numpy as np
> import matplotlib.pyplot as plt
> from scipy import stats
> import pickle
> import pymatreader
> import mffpy
> \#single sub evoked
> eeg1 = mne.io.read\_epochs\_eeglab(‘1\_LH.set’)
> \`\`\`
> 
> 
> \### Link to data
> 
> \_No response\_
> 
> \### Expected results
> 
> how to solve the problem
> 
> \### Actual results
> 
> eeg1 = mne.io.read\_epochs\_eeglab('1\_LH.set')
> Extracting parameters from E:\\code\\EEG ML code\\EEG\\part2\\2\_extra\_features\\Example\_data\\1\_LH.set...
> Traceback (most recent call last):
> 
> File "C:\\Users\\Administrator\\AppData\\Local\\Temp/ipykernel\_17044/1102068857.py", line 1, in \<module\>
> eeg1 = mne.io.read\_epochs\_eeglab('1\_LH.set')
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 337, in read\_epochs\_eeglab
> epochs = EpochsEEGLAB(input\_fname=input\_fname, events=events, eog=eog,
> 
> File "\<decorator-gen-296\>", line 12, in \_\_init\_\_
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 569, in \_\_init\_\_
> info, eeg\_montage, \_ = \_get\_info(eeg, eog=eog, scale\_units=scale\_units)
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 199, in \_get\_info
> \_get\_montage\_information(eeg, has\_pos, scale\_units=scale\_units)
> 
> File "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\mne\\io\\eeglab\\eeglab.py", line 150, in \_get\_montage\_information
> for item in list(zip(\*eeg.chaninfo\['nodatchans'\].values())):
> 
> TypeError: 'int' object is not iterable
> 
> \### Additional information
> 
> my mne version is 1.3.1
> windows 11
