[Biopython-dev] [Bug 3147] AlignIO.parse doesn't raise StopIteration on empty files

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Oct 20 09:12:06 UTC 2010


------- Comment #1 from biopython-bugzilla at maubp.freeserve.co.uk  2010-10-20 05:12 EST -------
In this case you are getting back None - which may have been allowed back on
Python 2.2, see also: http://docs.python.org/release/2.4/lib/typeiter.html

I'm used to iterators either returning None or raising StopIteration at the
end of the elements - but quite often I've had to write code like this:

while True:
        record = i.next()
    except StopIteration:
        record = None
    if record is None:

The above documentation implies it would be correct to expect a StopIteration
exception here.

This also applies to some of the Bio.SeqIO parsers too I'm sure, and
potentially other parsers in Biopython.

To identify most issues we can just change test_SeqIO.py and test_AlignIO.py
to check for the exception...


Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

More information about the Biopython-dev mailing list