holgern / pyedflib

pyedflib is a python library to read/write EDF+/BDF+ files based on EDFlib.
http://pyedflib.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
219 stars 125 forks source link

OSError: Encoding error #120

Closed Seaense closed 1 year ago

Seaense commented 3 years ago

"OSError: File S001R03.edf was found but can't be accessed. Make sure it contains no special characters or change your locale to use UTF" Am using the same file that you have used still getting the above error. And I have gone through the locale error still can't rectify the issue. Need some clear picture about it

skjerns commented 3 years ago
zfarzaneh commented 3 years ago

I have this problem too . I have pyEDFlib 0.1.22 . I use win10. I can open this file . I dont know how active utpf8 . plz help me.

skjerns commented 3 years ago

You can Google "utf8 support Windows 10" and follow the instructions?

What is the filename?

Additionally, can you install the master version from the repository? It might be that the problem is actually a different one, and the error message is given by mistake. I have fixed some things with regard to that.

zfarzaneh commented 3 years ago

My windows supported utf8 .but i get this error . My file name is S001R04.edf. It is data for eeg signals that I take it from physionet.org.

On Sun, Jun 27, 2021 at 8:27 PM Simon Kern @.***> wrote:

You can Google "utf8 support Windows 10" and follow the instructions?

What is the filename?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/holgern/pyedflib/issues/120#issuecomment-869185660, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJXXNTA5LGGPBU6RE3JVZ6DTU5C53ANCNFSM44EBASEQ .

skjerns commented 3 years ago

The file itself is corrupt. This is not a problem of pyedflib - opening with EDFBrowser will tell you additional details w.r.t that

skjerns commented 3 years ago

should be "fixed" now.

try installing the master version via pip install git+https://github.com/holgern/pyedflib.git, it should work now that the warning has been removed.

zfarzaneh commented 3 years ago

Thanks a lot .it fixed .

mbelley commented 3 years ago

Hi,

I have this to with fedora. does it have a permanent fix? I tryed install from 27 jun comment and didn't fix for me!

thank's

skjerns commented 3 years ago
mbelley commented 3 years ago
  • What's the filename and path you are trying to access?
  • Is the file generally open-able by other EDF-readers like EDFBrowser? If yes, can you upload it somewhere and link it here?
  • Can you run this in your terminal and report the output echo $LANG && echo $LC_CTYPE ?
  • Is there no other reported error or warning above the current error?

Hi,

thanks for answer. This is a sleep apnea edf resmed. Maybe there's some garbage in the file? I can read it with with open(file_name, 'rb') as f: contents = f.read() print(contents)

filename and path: "data/20210803_100630_CSL.edf"

file: [https://drive.google.com/file/d/1qtUxfcElwlRVp2fh44SUJjTiERB1_iCH/view?usp=sharing]

$ echo $LANG && echo $LC_CTYPE en_CA.UTF-8

stack:

OSError: File data/20210803_100630_CSL.edf was found but cant be accessed. Make sure it contains no special characters or change your locale to use UTF8. OSError Traceback (most recent call last) pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.init() pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.open() pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.check_open_ok() OSError: data/20210803_100630_CSL.edf: The file is discontinous and cannot be read During handling of the above exception, another exception occurred: OSError Traceback (most recent call last) /tmp/ipykernel_93955/2968901658.py in 1 from pyedflib import highlevel 2 ----> 3 signals, signal_headers, header = highlevel.read_edf(file_name) 4 # print(signal_headers[0]['sample_frequency']) # prints 256 ~/.local/share/virtualenvs/my_apnea_lab-Pw-np_4D/lib64/python3.9/site-packages/pyedflib/highlevel.py in read_edf(edf_file, ch_nrs, ch_names, digital, verbose) 326 not isinstance(ch_names, list): ch_names = [ch_names] 327 --> 328 with pyedflib.EdfReader(edf_file) as f: 329 # see which channels we want to load 330 available_chs = [ch.upper() for ch in f.getSignalLabels()] pyedflib/_extensions/_pyedflib.pyx in pyedflib._extensions._pyedflib.CyEdfReader.init() OSError: File data/20210803_100630_CSL.edf was found but cant be accessed. Make sure it contains no special characters or change your locale to use UTF8.

skjerns commented 3 years ago

Mhh, I cannot replicate the issue, the file loads fine for me, both on Windows and WSL.

Are you sure you are using the most up-to-date version of pyedflib? what prints if you write print(pyedflib.__version__)?

mbelley commented 3 years ago

Hi, I got: 0.1.22

skjerns commented 3 years ago

yes, that's not the current one. please install the version from master using pip install git+https://github.com/holgern/pyedflib.git, newest is 0.1.23. If you run that command and still have the same problem, than you likely have an environment problem, ie. your pip does not install into the correct python environment

mbelley commented 3 years ago

Thanks I'll make sure I have this version (need time...) and let you know.

All good now, thanks!

sedket commented 3 years ago

yes, that's not the current one. please install the version from master using pip install git+https://github.com/holgern/pyedflib.git, newest is 0.1.23. If you run that command and still have the same problem, than you likely have an environment problem, ie. your pip does not install into the correct python environment

Hi. I followed this to install the newest version but I got an error message: "ERROR: Could not build wheels for pyEDFlib which use PEP 517 and cannot be installed directly". I have successfully installed PEP 517 via pip install pep517 but the problem still arises. What should I do? Thanks in advance.

sedket commented 3 years ago

Thanks a lot .it fixed .

Hi. I'm trying to open the same file as you (the S001R04.edf). Was your problem fixed because you have installed the newest version or because you change the UTF8 thingy? Thank you.

skjerns commented 3 years ago

have you tried upgrading pip?

python -m pip install --upgrade pip