Though I'm not 100% sure what state the file handle gets left in, if it hits this error.
---------------------------------------------------------------------------
BufferError Traceback (most recent call last)
Input In [15], in <cell line: 1>()
----> 1 dc = scan.get_data()
Input In [6], in Scan_Info_Storage.get_data(self, shift_correct)
27 def get_data(self, shift_correct = False):
---> 28 dc = py4DSTEM.io.read(self.data_filepath)
29 dc.set_scan_shape(self.R_Nx,self.R_Ny)
30 if shift_correct:
File ~/miniconda3/envs/cuda-multcorr-sez/lib/python3.8/site-packages/py4DSTEM/io/read.py:99, in read(fp, mem, binfactor, ft, metadata, **kwargs)
95 data = read_py4DSTEM(
96 fp, mem=mem, binfactor=binfactor, metadata=metadata, **kwargs
97 )
98 elif ft == "dm":
---> 99 data = read_dm(fp, mem, binfactor, metadata=metadata, **kwargs)
100 elif ft == "empad":
101 data = read_empad(fp, mem, binfactor, metadata=metadata, **kwargs)
File ~/miniconda3/envs/cuda-multcorr-sez/lib/python3.8/site-packages/py4DSTEM/io/nonnative/read_dm.py:53, in read_dm(fp, mem, binfactor, metadata, **kwargs)
51 dataSet = dmFile.getDataset(i)
52 i += 1
---> 53 dc = DataCube(data=dataSet["data"])
54 elif (mem, binfactor) == ("MEMMAP", 1):
55 with dm.fileDM(fp, on_memory=False) as dmFile:
56 # loop through the datasets until a >2D one is found:
File ~/miniconda3/envs/cuda-multcorr-sez/lib/python3.8/site-packages/ncempy/io/dm.py:246, in fileDM.__exit__(self, exception_type, exception_value, traceback)
242 def __exit__(self, exception_type, exception_value, traceback):
243 """Implement python's with statement
244 and close the file via __del__()
245 """
--> 246 self.__del__()
247 return None
File ~/miniconda3/envs/cuda-multcorr-sez/lib/python3.8/site-packages/ncempy/io/dm.py:234, in fileDM.__del__(self)
232 if self._v:
233 print('Closing input file: {}'.format(self.file_path))
--> 234 self.fid.close()
BufferError: cannot close exported pointers exist