Skip to content

Bio SwissProt.read() broken in Python 3.5 (biopython 1.66 np110py35_0) #773

@fpmenninger

Description

@fpmenninger

Windows7 Python 3.5.1 Anaconda 2.5.0 biopython 1.66 np110py35_0
(in jupyter)

from Bio import ExPASy    
handle = ExPASy.get_sprot_raw("P75952")
from Bio import SwissProt
record = SwissProt.read(handle)

results in:

---------------------------------------------------------------------------
IncompleteRead                            Traceback (most recent call last)
<ipython-input-1-11c8db89238e> in <module>()
      3 print(handle)
      4 from Bio import SwissProt
----> 5 record = SwissProt.read(handle)
      6 print(record)

C:\Anaconda3\lib\site-packages\Bio\SwissProt\__init__.py in read(handle)
    135     ##print(handle.url," ",handle," ",handle.fp)
    136     ##handle.fp = None
--> 137     remainder = handle.read()
    138     print(remainder)
    139     if remainder:

C:\Anaconda3\lib\http\client.py in read(self, amt)
    446             else:
    447                 try:
--> 448                     s = self._safe_read(self.length)
    449                 except IncompleteRead:
    450                     self._close_conn()

C:\Anaconda3\lib\http\client.py in _safe_read(self, amt)
    596             print(chunk, "\n")
    597             if not chunk:
--> 598                 raise IncompleteRead(b''.join(s), amt)
    599             s.append(chunk)
    600             amt -= len(chunk)

IncompleteRead: IncompleteRead(0 bytes read, 6066 more expected)

from what I can tell (not much experience here)

it seems something changed in how lines are read in __init__.py of SwissProt
such that when handle.read() of http/client is called,
different values are sent than were before.

The Python 3.5.1 version (biopython 1.66 np110py35_0) passes http/client.read a header with
length = 6066 and fp = <_io.BufferedReader name=1156>
whereas Python 3.4.4 (biopython 1.66 np110py34_0) version passes a header with
length = 0 and fp = None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions