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

How to close an already opened file? #9

Closed
madhavpr opened this issue Dec 14, 2016 · 1 comment
Closed

How to close an already opened file? #9

madhavpr opened this issue Dec 14, 2016 · 1 comment

Comments

@madhavpr
Copy link

madhavpr commented Dec 14, 2016

Hi,

I'm trying to read EEG signals and I'm quite new to this field. I ran the following script.

f = pyedflib.EdfReader("chb01_01.edf")
print(f)
n = f.signals_in_file
print("number of signals in file:", n)
signal_labels = f.getSignalLabels()
print("signal_labels:", signal_labels)

It worked fine when I ran it for the first time. However, if I run it again, I get the following error:

IOError: file has already been opened

I have tried inserting 1. f._close() 2. f._close() followed by del f, after the print("signal_labels..... ) function but failed. Is there a way to fix this error? Thanks a lot

@holgern
Copy link
Owner

holgern commented Apr 28, 2017

Should work now
In order to close, do the following:

f._close()
del f

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

No branches or pull requests

2 participants