intake / intake/intake-xarray

File does not close

Open
#148 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
76
Forks
36
PR merge metrics
No merged PRs in 30d

Description

When using Intake.open_netcdf('example.nc') and closing via ds.close(), the file is not closed, which causes problems when you want to delete the file in the program, for example.

In Intake-xarray/base.py
```python
def close(self):
"""Delete open file from memory"""
if self._ds is not None:
self._ds.close() #Closes the file correctly
self._ds = None
self._schema = None
```
Without this modification, here's the error I get when I try to delete the netcdf file:
`PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'data_2024-07-31.nc'`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.