From bea02cc7a5eac1324c8d4a07f541223ac3ee0b37 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Wed, 10 Aug 2016 16:25:45 +0200 Subject: [PATCH] Added (temporary?) check for the type of quality strings because the import now seems to return them with bytes type --- python/obitools3/obidms/_obidmscolumn_qual.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/obitools3/obidms/_obidmscolumn_qual.pyx b/python/obitools3/obidms/_obidmscolumn_qual.pyx index 00d82ab..f8c4635 100644 --- a/python/obitools3/obidms/_obidmscolumn_qual.pyx +++ b/python/obitools3/obidms/_obidmscolumn_qual.pyx @@ -70,11 +70,16 @@ cdef class OBIDMS_column_qual(OBIDMS_column): free(value_b) cpdef set_str_line(self, index_t line_nb, object value): + cdef bytes value_b if value is None : if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, OBIQual_char_NA) < 0: raise Exception("Problem setting a value in a column") else : - if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, str2bytes(value)) < 0: + if type(value) == str: + value_b = str2bytes(value) + else : + value_b = value + if obi_set_qual_char_with_elt_idx_and_col_p_in_view(self.view.pointer, (self.pointer)[0], line_nb, 0, value_b) < 0: raise Exception("Problem setting a value in a column")