Fixed the ultimate bug with embl (and genbank) parsers: raising any
exception in a python generator makes it unable to resume. So now, exceptions are not raised but printed, then functions return None and that's handled at higher level.
This commit is contained in:
@ -45,7 +45,7 @@ def emblParser(bytes text):
|
||||
|
||||
s = _seqMatcher.search(text).group()
|
||||
s = _cleanSeq.sub(b'', s).upper()
|
||||
|
||||
|
||||
acs = _acMatcher.search(text).group()
|
||||
acs = acs.replace(b';', b' ')
|
||||
acs = acs.split()
|
||||
@ -55,11 +55,11 @@ def emblParser(bytes text):
|
||||
de = _deMatcher.search(header).group()
|
||||
de = _cleanDe.sub(b' ', de).strip().strip(b'.')
|
||||
|
||||
except AttributeError,e:
|
||||
print('=======================================================')
|
||||
print(text)
|
||||
print('=======================================================')
|
||||
raise e
|
||||
except Exception as e:
|
||||
print("\nCould not import sequence id:", text.split()[1], "(error raised:", e, ")")
|
||||
# Do not raise any Exception if you need the possibility to resume the generator
|
||||
# (Python generators can't resume after any exception is raised)
|
||||
return None
|
||||
|
||||
tags = {}
|
||||
extractTaxon(ft, tags)
|
||||
|
Reference in New Issue
Block a user