You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
% ls - l
-rw-r--r--@ 1 alessandraquig staff 48 Jan 7 23:31 example.nc
The simple workaround is to delete the file first, but this seems bizarre given the point of clobber=True is to allow me to overwrite an existing file.
The text was updated successfully, but these errors were encountered:
Clobbering an existing file is different from opening it twice for writing. If you have an example.nc and writes a new one, clobber will work as expected. However, what you are doing is opening it twice and you can prevent that using Python's with statement or closing the file handle.
importosfromnetCDF4importDataset# do not delete your example.nc and you'll see it will be clobbered without an error here and than again below. withDataset('example.nc', mode='w', format='NETCDF4', clobber=True) asmhw:
pass# do somethingmhw=Dataset('example.nc', mode='w', format='NETCDF4', clobber=True)
mhw.close()
When I write a dataset to the same file twice (even with
clobber=True
), I get an OS error:Computer: Apple M3 Pro
Operating system: macOS version 14.6.1 (23G93)
Library versions (installed using conda):
Permissions for the created file:
The simple workaround is to delete the file first, but this seems bizarre given the point of
clobber=True
is to allow me to overwrite an existing file.The text was updated successfully, but these errors were encountered: