Adjust ChoiceSetting.convert_from_text to handle numpy character ndarrays.
authorW. Trevor King <wking@drexel.edu>
Sun, 25 Sep 2011 23:39:17 +0000 (19:39 -0400)
committerW. Trevor King <wking@drexel.edu>
Sun, 25 Sep 2011 23:39:17 +0000 (19:39 -0400)
h5config/config.py

index 0dd6898228f1899b7b3597c4f10ff631c7532f22..5fab0050734e10439ae707d3a3609efdef4d2169 100644 (file)
@@ -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):