From fbdcc0f9f48a5f6eee45f1b506e63767a5c17604 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 25 Sep 2011 19:39:17 -0400 Subject: [PATCH] Adjust ChoiceSetting.convert_from_text to handle numpy character ndarrays. --- h5config/config.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/h5config/config.py b/h5config/config.py index 0dd6898..5fab005 100644 --- a/h5config/config.py +++ b/h5config/config.py @@ -20,6 +20,8 @@ import copy as _copy +import numpy as _numpy + from . import LOG as _LOG @@ -83,6 +85,9 @@ class ChoiceSetting (Setting): return ret.strip() def convert_from_text(self, value): + if (isinstance(value, _numpy.ndarray) and + value.dtype.type == _numpy.string_): + value = str(value) return dict(self.choices)[value] def convert_to_text(self, value): -- 2.26.2