-
Notifications
You must be signed in to change notification settings - Fork 58
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
problem using with
to read a file
#168
Comments
You can use a with block, but it needs to be active as long as you need access to the data. (The data is memmapped and the memmap handles are closed at the same time as the file handle). You can also use an explicit |
Right. I knew that. Sorry about the noise. |
I think there should still be more control over this kind of thing. PyFITS deliberately leaves the mmaps open because it's an implementation detail which most users won't even tend to understand, and not allowing this to work I think discourages use of the Of course, PyFITS has the opposite problem where users think they've closed the file but they really haven't. I think both should have some way to control this better (but I lean toward leaning mmaps open except when the user has explicitly requested to close them as well). |
Yeah -- there's sort of no perfect option here. A kwarg to indicate whether to close the mmaps automatically might be helpful, though. |
@mdboom Should I not use
with
to open asdf files? Or am I doing something wrong?The text was updated successfully, but these errors were encountered: