TypeError: ‘float’ object does not support item assignment
See original GitHub issue- MNE-Python version: 0.22.0
- operating system: Windows & Mac
Describe the bug
TypeError: ‘float’ object does not support item assignment
I was trying to read in a hypnogram edf file using python. The data is directly from PhysioNet For example, when I tried to process this file using my code below, it threw an error.
Steps to reproduce
import mne
data = mne.io.read_raw_edf("SC4001EC-Hypnogram.edf")
ERROR results
Extracting EDF parameters from C:\Users\yxie\Desktop\healthcare\SC4001EC-Hypnogram.edf...
EDF file detected
Traceback (most recent call last):
File "<ipython-input-77-d358ed2921e8>", line 4, in <module>
data = mne.io.read_raw_edf(localpath)
File "C:\Users\yxie\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 1217, in read_raw_edf
return RawEDF(input_fname=input_fname, eog=eog, misc=misc,
File "<decorator-gen-182>", line 24, in __init__
File "C:\Users\yxie\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 114, in __init__
info, edf_info, orig_units = _get_info(input_fname,
File "C:\Users\yxie\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 358, in _get_info
edf_info, orig_units = _read_header(fname, exclude)
File "C:\Users\yxie\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 345, in _read_header
return _read_edf_header(fname, exclude)
File "C:\Users\yxie\Anaconda3\lib\site-packages\mne\io\edf\edf.py", line 598, in _read_edf_header
record_length = record_length[0] = 1.
TypeError: 'float' object does not support item assignment
Additional information
Note: I’m only showing my Windows setup here. But it also failed on my Mac.
Platform: Windows-10-10.0.18362-SP0 Python: 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)] Executable: C:\Users\yxie\Anaconda3\python.exe CPU: Intel64 Family 6 Model 158 Stepping 13, GenuineIntel: 12 cores Memory: 15.8 GB
mne: 0.22.0 numpy: 1.19.5 {blas=D:\a\1\s\numpy\build\openblas_info, lapack=D:\a\1\s\numpy\build\openblas_lapack_info} scipy: 1.5.0 matplotlib: 3.2.2 {backend=module://ipykernel.pylab.backend_inline}
sklearn: 0.23.2 numba: 0.50.1 nibabel: Not found nilearn: Not found dipy: Not found cupy: Not found pandas: 1.2.2 mayavi: Not found pyvista: Not found vtk: Not found
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
I mean raise an exception with a meaningful error message saying to use read_annotations
Nice, thanks @agramfort, this works! What do you mean by “point to this”? When reading such a file with
read_raw_edf
, what should happen? Just issue a more informative error?