Taxonomy: fixed an issue related to StopIteration behaviour in new
versions of python
This commit is contained in:
@ -325,8 +325,9 @@ cdef class Taxonomy(OBIWrapper) :
|
||||
cdef Taxon taxon
|
||||
try:
|
||||
taxon = self.get_taxon_by_taxid(taxid)
|
||||
except:
|
||||
raise StopIteration
|
||||
except Exception as e:
|
||||
print('\n'+e, file=sys.stderr)
|
||||
return
|
||||
if taxon is not None:
|
||||
while taxon.taxid != 1:
|
||||
yield taxon
|
||||
@ -334,7 +335,7 @@ cdef class Taxonomy(OBIWrapper) :
|
||||
taxon = taxon.parent
|
||||
yield taxon
|
||||
else:
|
||||
raise StopIteration
|
||||
return
|
||||
|
||||
|
||||
def is_ancestor(self, int ancestor_taxid, int taxid):
|
||||
|
Reference in New Issue
Block a user