我正在尝试使用 Entrez 将发布数据导入数据库。搜索部分工作正常,但是当我尝试解析时:
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()
...我收到以下错误:
解析中的文件“/venv/lib/python2.7/site-packages/Bio/Entrez/Parser.py”,第 296 行引发 ValueError(“XML 文件不代表列表。请使用 Entrez.read 而不是 Entrez .parse") ValueError:XML 文件不代表列表。请使用 Entrez.read 而不是 Entrez.parse
这段代码直到几天前才有效。任何想法这里可能出了什么问题?
此外,查看源代码(http://biopython.org/DIST/docs/api/Bio.Entrez-pysrc.html)并尝试遵循列出的示例,会给出相同的错误:
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()