diff --git a/python/obitools3/utils.pyx b/python/obitools3/utils.pyx index 5d5cbdc..acc884f 100644 --- a/python/obitools3/utils.pyx +++ b/python/obitools3/utils.pyx @@ -15,7 +15,10 @@ from obitools3.dms.capi.obierrno cimport OBI_LINE_IDX_ERROR, \ OBI_ELT_IDX_ERROR #obi_errno +#from obitools3.dms.obiseq cimport Nuc_Seq, Nuc_Seq_Stored + +# TODO RollbackException? cdef obi_errno_to_exception(int obi_errno, index_t line_nb=-1, object elt_id=None, str error_message=None) : global obi_errno if obi_errno > 0 : @@ -60,6 +63,8 @@ cdef bytes tobytes(object string): @return a transcoded string @rtype: bytes """ + if string is None: + return None if isinstance(string, bytes): return string return str2bytes(string) @@ -98,7 +103,7 @@ cdef obitype_t get_obitype_single_value(object value) : elif value_type == bool : value_obitype = OBI_BOOL elif value_type == str or value_type == bytes : - if is_a_DNA_seq(tobytes(value)) : + if is_a_DNA_seq(tobytes(value)): #or value_type == Nuc_Seq or value_type == Nuc_Seq_Stored: # TODO discuss value_obitype = OBI_SEQ elif len(value) == 1 : value_obitype = OBI_CHAR