I'm running into a problem with the h5py module for python.
I'm trying to open a file in 'r+' mode and would like to change some characters within this file.
Whenever I overwrite the data, the character is deleted.
This is what I get:
>>> f = h5py.File(someFile, 'r+')
>>> f[someCharacters]
<HDF5 dataset "someChar": shape (83,), type "|S1">
>>> f[someCharacters][-7]
'l'
>>> f[someCharacters][-7] = 't'
>>> f.flush()
>>> f[someCharacters][-7]
''
>>> f.close()
Reopening the file doesn't help either...
>>> f = h5py.File(someFile, 'r+')
>>> f[someCharacters][-7]
''
>>> f.close()
I tried doing the same thing with a file that I created myself and that works just fine:
>>> f = h5py.File('./testFile.h5', 'r+')
>>> dset = f['myDSet']
>>> dset
<HDF5 dataset "myDSet": shape (100,), type "|S1">
>>> dset[5]
''
>>> dset[5] = 'r'
>>> dset[5]
'r'
>>> f.close()
>>> f = h5py.File('./testFile.h5', 'r+')
>>> f['myDSet'][5]
'r'
>>> f.close()
So I guess there's something special to the specific file 'someFile' that I'm trying to edit.
Thanks a lot for any suggestions or help!