[Biopython-dev] Type vs type in Entrez.esummary XML (via BioStar)

Peter Cock p.j.a.cock at googlemail.com
Mon Aug 22 06:53:17 UTC 2011


Hi all,

On Sun, Aug 21, 2011 at 8:48 AM, Feed My Inbox <updates at feedmyinbox.com> wrote:
> // Error using Entrez.esummary from biopython
> // August 16, 2011 at 8:47 AM
>
> http://biostar.stackexchange.com/questions/11232/error-using-entrez-esummary-from-biopython
> Can someone please explain this error?
>
> I hava a smal script that tries to fetch information from the a
> NCBI BioAssay using the Entrez module form Bipython. I get
> an error I do not understand. I try to run:
>
> from Bio import Entrez
> Entrez.email="yourname at mail.se"
>
> handle_esummary=Entrez.esummary(db='pcassay',id='1337')
> record_esummary=Entrez.read(handle_esummary)
>
>
> I get the error:
>
> File "smaltest.py", line 5, in <module>
>    record_esummary=Entrez.read(handle_esummary)
>  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/__init__.py", line 297, in read
>    record = handler.run(handle)
>  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 90, in run
>    self.parser.ParseFile(handle)
>  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 105, in startElement
>    itemtype = str(attrs["Type"]) # convert from Unicode
> KeyError: 'Type'
>

I can reproduce this and The cause is the NCBI using
lowercase in one tag's attribute:

<Item Name="SourceNameList" type="List">

We're expecting the attributes to be Name and Type, and
that is the case for all the other <Item> tags in this file.

Michiel - do you think we should just add a fallback for
type if we get a KeyError on Type? Do you think we should
report this inconsistency/bug to the NCBI?

Peter




More information about the Biopython-dev mailing list