[Biopython] Moving from Bio.PubMed to Bio.Entrez

Brad Chapman chapmanb at 50mail.com
Fri Jul 17 12:01:29 UTC 2009


Hi Martin;
Thanks for the e-mail. Let's tackle your up to date 1.51beta work.

> When I upgrade to 1.51b I get slightly better results:
> 
> >>> from Bio import Entrez, Medline, GenBank
> >>> Entrez.email = "mmokrejs at iresite.org"
> >>> _handle = Entrez.efetch(db="pubmed", id=10851087, retmode="text")
> >>> _records = Entrez.read(_handle)
[ error ]

> >>> _handle = Entrez.efetch(db="pubmed", id=10851087, retmode="XML")
> >>> _records = Entrez.read(_handle)
> >>> _records
[ worked ]

>   Any clues what does that mean? TIA,

In the first (and also third) example, you are retrieving the text
based result. The Entrez parser handles XML output, so it is
complaining because it's getting the raw text record instead of XML. 

Your second example is correct and worked; you specified the correct
XML retmode. You should be able to go with this.

More generally, since Entrez returns many different file types, you
want to be sure and match up what you are getting with the parser
you are using.

Hope this helps,
Brad



More information about the Biopython mailing list