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
When I create a dataset with the libver= 'latest', the terminal crashes with the "group.copy" command.
In the following example program, the kernel will crash.
libversion = ('latest', 'earliest')
arr1 = np.random.randn(1000)
with h5py.File('testfile.h5', 'w', libver=libversion[0]) as f:
g = f.create_group('Base_Group2', track_order=True)
dset = g.create_dataset('dataset', (1000,))
dset[:] = arr1
for i in range(10):
dset.attrs["int" + str(i)] = int(10)
for i in range(10):
dset.attrs["string"+str(i)] = str("text")
with h5py.File('Copy.hdf5', 'w') as f:
g = f.create_group("Base_Group")
with h5py.File('testfile.h5', 'r') as f2:
g.copy(f2["Base_Group2"], g)
Out: Windows fatal exception: access violation
Main thread:
Current thread 0x000005dc (most recent call first):
Kernel is restarted
With the libver= 'earliest' the copy command works as intended. However, I needed the function swmr_mode,
so I am dependent on the libversion latest.
I found out that the error is caused by variables string lengths in the attributes.
A workaround is to fixed the string length.
text = "text"
string_length = len(text)
utf8_type = h5py.string_dtype('utf-8', string_length)
Can someone tell me if this is a bug or if I had made a mistake somewhere?
It's a bug. Even if you're doing something wrong (which I don't think you are), mistakes in Python code should always give you a Python exception, not a hard crash like that.
It's very likely to be a bug in HDF5 itself, because the Group.copy() method in h5py is basically just wrapping the HDF5 H5Ocopy function. It might be the same as, or related to, this issue, which also involves crashes while copying objects with attributes. Or it might be a separate problem.
@aragilar I use pip to install h5py. The error message only appears in Spyder, not when I run the program via the CMD/Python Console. No error message is displayed there. Nevertheless, the copy command is also not executed.
When I create a dataset with the libver= 'latest', the terminal crashes with the "group.copy" command.
In the following example program, the kernel will crash.
With the libver= 'earliest' the copy command works as intended. However, I needed the function swmr_mode,
so I am dependent on the libversion latest.
I found out that the error is caused by variables string lengths in the attributes.
A workaround is to fixed the string length.
Can someone tell me if this is a bug or if I had made a mistake somewhere?
Config of the System:
Windows 10
The text was updated successfully, but these errors were encountered: