[Biopython-dev] [Bug 2652] New: Bio.Fasta.Iterator fails with IndexError when opening empty fasta files

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Tue Nov 11 11:30:16 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2652

           Summary: Bio.Fasta.Iterator fails with IndexError when opening
                    empty fasta files
           Product: Biopython
           Version: Not Applicable
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Main Distribution
        AssignedTo: biopython-dev at biopython.org
        ReportedBy: rjalves at igc.gulbenkian.pt


Instead of IndexError a better error handling or at least a more explicit error
message. At the first look it's not obvious what is causing the error.

Example:

In [1]: from Bio import Fasta

In [2]: Fasta.Iterator(open("empty.fasta"))
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/var/lib/python-support/python2.5/Bio/Fasta/__init__.pyc in __init__(self,
handle, parser, debug)
     65         while True :
     66             line = handle.readline()
---> 67             if line[0] == ">" :
     68                 break
     69             if debug : print "Skipping: " + line

IndexError: string index out of range


-- 
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