I am trying to use Entrez to import publication data into a database. Part of the search works fine, but when I try to parse:
from Bio import Entrez def create_publication(pmid): handle = Entrez.efetch("pubmed", id=pmid, retmode="xml") records = Entrez.parse(handle) item_data = records.next() handle.close()
... I get the following error:
File "/venv/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 296, in a parse raise ValueError ("The XML file does not represent a list. Use Entrez.read instead of Entrez.parse") ValueError: The XML file is not a list. Use Entrez.read instead of Entrez.parse
This code worked until a few days ago. Any ideas what might be wrong here?
Also, looking at the source code ( http://biopython.org/DIST/docs/api/Bio.Entrez-pysrc.html ) and trying to follow the given example, the same error appears:
from Bio import Entrez Entrez.email = " Your.Name.Here@example.org " handle = Entrez.efetch("pubmed", id="19304878,14630660", retmode="xml") records = Entrez.parse(handle) for record in records: print(record['MedlineCitation']['Article']['ArticleTitle']) handle.close()
source share