# Error encounterd while reading edf file

**URL:** <https://mne.discourse.group/t/error-encounterd-while-reading-edf-file/4067>\
**Category:** Support & Discussions\
**Tags:** data-import\
**Created:** [December 2, 2021, 1:37pm UTC](https://mne.discourse.group/t/error-encounterd-while-reading-edf-file/4067 "2021-12-02T13:37:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JaiC96](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/jaic96/32/1036_2.png) [@JaiC96](https://mne.discourse.group/u/JaiC96)\
**Post date:** [December 2, 2021, 1:37pm UTC](https://mne.discourse.group/t/error-encounterd-while-reading-edf-file/4067/1 "2021-12-02T13:37:38Z")

</div>

**❓ If you have a question or issue with MNE-Python, please include the following info:**

- MNE version: mne-0.24.1
- operating system: Windows 11

Error encountered on google colab, same code is working good on windows

Code :

```python
for i in x_train: 
    for j in y_train:
        while i[:5]==j[:5]:
            raw= mne.io.read_raw_edf(i,stim_channel='auto',preload=True)
            annot_train = mne.read_annotations(j)
            raw.set_annotations(annot_train, emit_warning=True)
            break

```

Error :

```python
Extracting EDF parameters from /content/drive/My Drive/Sleep_data/hmc-sleep-staging/1.0.1/recordings/SN072.edf...
EDF file detected

---------------------------------------------------------------------------

ValueError Traceback (most recent call last)

<ipython-input-25-11ea122c576d> in <module>()
      2 for j in y_train:
      3 while i[:5]==j[:5]:
----> 4 raw= mne.io.read_raw_edf(i)
      5 annot_train = mne.read_annotations(j)
      6 raw.set_annotations(annot_train, emit_warning=True)

5 frames

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in read_raw_edf(input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose)
   1347 return RawEDF(input_fname=input_fname, eog=eog, misc=misc,
   1348 stim_channel=stim_channel, exclude=exclude,
-> 1349 infer_types=infer_types, preload=preload, verbose=verbose)
   1350 
   1351 

<decorator-gen-215> in __init__ (self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose)

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in __init__ (self, input_fname, eog, misc, stim_channel, exclude, infer_types, preload, verbose)
    140 info, edf_info, orig_units = _get_info(input_fname, stim_channel, eog,
    141 misc, exclude, infer_types,
--> 142 preload)
    143 logger.info('Creating raw.info structure...')
    144 

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _get_info(fname, stim_channel, eog, misc, exclude, infer_types, preload)
    382 misc = misc if misc is not None else []
    383 
--> 384 edf_info, orig_units = _read_header(fname, exclude, infer_types)
    385 
    386 # XXX: `tal_ch_names` to pass to `_check_stim_channel` should be computed

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _read_header(fname, exclude, infer_types)
    369 logger.info('%s file detected' % ext.upper())
    370 if ext in ('bdf', 'edf'):
--> 371 return _read_edf_header(fname, exclude, infer_types)
    372 elif ext == 'gdf':
    373 return _read_gdf_header(fname, exclude), None

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in _read_edf_header(fname, exclude, infer_types)
    630 else:
    631 meas_date = fid.read(8).decode('latin-1')
--> 632 day, month, year = [int(x) for x in meas_date.split('.')]
    633 year = year + 2000 if year < 85 else year + 1900
    634 

/usr/local/lib/python3.7/dist-packages/mne/io/edf/edf.py in <listcomp>(.0)
    630 else:
    631 meas_date = fid.read(8).decode('latin-1')
--> 632 day, month, year = [int(x) for x in meas_date.split('.')]
    633 year = year + 2000 if year < 85 else year + 1900
    634 

ValueError: invalid literal for int() with base 10: 'el="styl'

```

---

<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:** [December 7, 2021, 11:42am UTC](https://mne.discourse.group/t/error-encounterd-while-reading-edf-file/4067/2 "2021-12-07T11:42:31Z")

</div>

Hello @JaiC96 and welcome to the forum! Any chance you could share this file with us so we can have a look?

Best wishes,  
Richard
