From 490be2b6cc5ee3a697e5929e4e9f6bb5b7ae4548 Mon Sep 17 00:00:00 2001 From: jreadey Date: Tue, 11 Apr 2023 16:04:57 +0100 Subject: [PATCH] fix for numpy array creation error with non-utf8 strings --- h5pyd/_apps/utillib.py | 1 + test/apps/config.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/h5pyd/_apps/utillib.py b/h5pyd/_apps/utillib.py index c36e60e7..34f0ec88 100755 --- a/h5pyd/_apps/utillib.py +++ b/h5pyd/_apps/utillib.py @@ -365,6 +365,7 @@ def copy_attribute(desobj, name, srcobj, ctx): if ctx["verbose"]: print(msg) data = data.decode("utf-8", errors="surrogateescape") + src_dt = None # let numpy figure out the unicode type # First, make sure we have a NumPy array. if is_h5py(srcobj): diff --git a/test/apps/config.py b/test/apps/config.py index c5f0c400..fe281a75 100755 --- a/test/apps/config.py +++ b/test/apps/config.py @@ -19,7 +19,8 @@ def get_test_filenames(): "d_link_hard.h5", "d_link_soft.h5", "scale_offset.h5", - "fletcher32.h5" + "fletcher32.h5", + "undecodable_attr.h5" ) cfg = {