pyedflib icon indicating copy to clipboard operation
pyedflib copied to clipboard

OSError: Encoding error

Open Seaense opened this issue 3 years ago • 17 comments

"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

Seaense avatar May 05 '21 06:05 Seaense

  • Which OS are you on and which version of pyedflib do you have installed?
  • Can you post the complete path to the file? the name itself seems not to be the problem
  • Can you access the file using vanilla python and open(filename)?
  • Did you activate UTF8 encoding?

skjerns avatar May 13 '21 17:05 skjerns

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.

zfarzaneh avatar Jun 27 '21 14:06 zfarzaneh

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.

skjerns avatar Jun 27 '21 15:06 skjerns

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 .

zfarzaneh avatar Jun 27 '21 18:06 zfarzaneh

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 avatar Jun 27 '21 19:06 skjerns

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.

skjerns avatar Jun 27 '21 19:06 skjerns

Thanks a lot .it fixed .

zfarzaneh avatar Jun 28 '21 17:06 zfarzaneh

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

mbelley avatar Aug 14 '21 13:08 mbelley

  • 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?

skjerns avatar Aug 14 '21 14:08 skjerns

  • 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.


mbelley avatar Aug 14 '21 15:08 mbelley

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__)?

skjerns avatar Aug 14 '21 19:08 skjerns

Hi, I got: 0.1.22

mbelley avatar Aug 14 '21 19:08 mbelley

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

skjerns avatar Aug 14 '21 20:08 skjerns

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

All good now, thanks!

mbelley avatar Aug 14 '21 21:08 mbelley

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 avatar Oct 07 '21 11:10 sedket

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.

sedket avatar Oct 07 '21 11:10 sedket

have you tried upgrading pip?

python -m pip install --upgrade pip

skjerns avatar Oct 07 '21 12:10 skjerns