Skip to content

Commit

Permalink
Move init of __file and __openlink up to prevent warning during close
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Jan 19, 2023
1 parent 7908b97 commit f79b3a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ def __init__(self, **kwargs):
path, manager, mode, comm, file_obj, driver = popargs('path', 'manager', 'mode', 'comm', 'file', 'driver',
kwargs)

self.__open_links = [] # keep track of other files opened from links in this file
self.__file = None # This will be set below, but set to None first in case an error occurs and we need to close

if path is None and file_obj is None:
raise ValueError("You must supply either a path or a file.")

Expand Down Expand Up @@ -89,7 +92,6 @@ def __init__(self, **kwargs):
self.__dci_queue = HDF5IODataChunkIteratorQueue() # a queue of DataChunkIterators that need to be exhausted
ObjectMapper.no_convert(Dataset)
self._written_builders = WriteStatusTracker() # track which builders were written (or read) by this IO object
self.__open_links = [] # keep track of other files opened from links in this file

@property
def comm(self):
Expand Down

0 comments on commit f79b3a2

Please sign in to comment.