diff --git a/datalad_fuse/fuse_.py b/datalad_fuse/fuse_.py index 8c7a590..42b4d07 100644 --- a/datalad_fuse/fuse_.py +++ b/datalad_fuse/fuse_.py @@ -163,7 +163,10 @@ def getattr(self, path, fh=None): fsspec_file, timestamp=self._adapter.get_commit_datetime(path) ) if to_close: - fsspec_file.close() + try: + fsspec_file.close() + except KeyError as e: + lgr.debug("KeyError encountered while closing file: %s", e) else: # TODO: although seems to be logical -- seems to cause logging etc # lgr.error("ENOENTing %s %s", path, fh) @@ -259,7 +262,10 @@ def release(self, path, fh): # files, so we need to provide some proper use of lru_cache # to have not recently used closed if f is not None and not f.closed: - f.close() + try: + f.close() + except KeyError as e: + lgr.debug("KeyError encountered while closing file: %s", e) return 0 def readlink(self, path):