[BioPython] 1.00a2 bug report (+ kludge fix)

Jeffrey Chang jchang@SMI.Stanford.EDU
Wed, 1 Aug 2001 09:43:00 -0700


Hi Jan,

This is indeed a bug in the current release.  Andrew Dalke noted it 
earlier and provided the fix:

     def read(self, size=-1):
         if size == -1:
             saved = string.join(self._saved, "")
             self._saved[:] = []
         else:
             saved = ''
             while size > 0 and self._saved:
                 if len(self._saved[0]) <= size:
                     size = size - len(self._saved[0])
                     saved = saved + self._saved.pop(0)
                 else:
                     saved = saved + self._saved[0][:size]
                     self._saved[0] = self._saved[0][size:]
                     size = 0
         return saved + self._handle.read(size)

This is in CVS now and will be incorporated into the next release.


>As a remark regarding distinction of error messages versus GenBank records
>in the HTTP response, it might be a better method to look at the MIME type
>of the response. This is text/plain in case of a successful record retrieval,
>but text/html if errors are reported. This might serve as as a basis for
>additional / improved methods for error detection.

Yes, that's a really good idea.  It'll take a bit of work to 
incorporate within the current framework, but I think it would be 
useful.  Another thing on the to-do list!

Thanks,
Jeff