[Biopython] Entrez.read(handle) for Bio._py3k.EvilHandleHack throws error with python 3.2
Richard Llewellyn
llewelr at gmail.com
Mon Jul 23 23:20:00 EDT 2012
Follow up for Entrez.read error on EvilHandleHack object:
(this is python 3.2.3)
If I change last line of Entrez.__init__.py _open function from
return _binary_to_string_handle(handle)
to
return handle
this error does not occur in example given below.
On Mon, Jul 23, 2012 at 8:24 PM, Richard Llewellyn <llewelr at gmail.com> wrote:
> With python 3.2 and biopython 1.60 after getting a handle using
> Entrez.esummary (and esearch, others?) I get a TypeError:
>
>
>>>> from Bio import Entrez
>>>> Entrez.email = "Your.Name.Here at example.org"
>>>> handle = Entrez.esummary(db="journals", id="30367")
>>>> record = Entrez.read(handle)
>
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/local/lib/python3.2/site-packages/Bio/Entrez/__init__.py",
> line 351, in read
> record = handler.read(handle)
> File "/usr/local/lib/python3.2/site-packages/Bio/Entrez/Parser.py",
> line 169, in read
> self.parser.ParseFile(handle)
> TypeError: read() did not return a bytes object (type=str)
>
>>>> handle
> <Bio._py3k.EvilHandleHack object at 0xb737a34c>
>
> Ah, it is evil!
>
> I realize py3k not yet officially supported.
>
> Thanks for the great work.
More information about the Biopython
mailing list