Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError: Encoding error #120

Closed
Seaense opened this issue May 5, 2021 · 17 comments
Closed

OSError: Encoding error #120

Seaense opened this issue May 5, 2021 · 17 comments

Comments

@Seaense
Copy link

Seaense commented May 5, 2021

"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
Copy link
Collaborator

skjerns commented May 13, 2021

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

@zfarzaneh
Copy link

zfarzaneh commented Jun 27, 2021

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
Copy link
Collaborator

skjerns commented Jun 27, 2021

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
Copy link

zfarzaneh commented Jun 27, 2021 via email

@skjerns
Copy link
Collaborator

skjerns commented Jun 27, 2021

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
Copy link
Collaborator

skjerns commented Jun 27, 2021

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
Copy link

Thanks a lot .it fixed .

@mbelley
Copy link

mbelley commented Aug 14, 2021

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
Copy link
Collaborator

skjerns commented Aug 14, 2021

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

@mbelley
Copy link

mbelley commented Aug 14, 2021

  • 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
Copy link
Collaborator

skjerns commented Aug 14, 2021

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
Copy link

mbelley commented Aug 14, 2021

Hi, I got: 0.1.22

@skjerns
Copy link
Collaborator

skjerns commented Aug 14, 2021

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
Copy link

mbelley commented Aug 14, 2021

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

All good now, thanks!

@sedket
Copy link

sedket commented Oct 7, 2021

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
Copy link

sedket commented Oct 7, 2021

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
Copy link
Collaborator

skjerns commented Oct 7, 2021

have you tried upgrading pip?

python -m pip install --upgrade pip

@skjerns skjerns closed this as completed Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants