Biopython Entrez.read()不工作

Biopython Entrez.read()不工作,python,biopython,Python,Biopython,我正在使用Biopython软件包,但它的一个功能有问题。我严格遵守文件包()的规定: 这就是我尝试过的: from Bio import Entrez Entrez.email = "myemail@myuniversity" handle = Entrez.einfo(db = "pubmed") record = Entrez.read(handle) 我得到了这个错误 File "<stdin>", line 1, in <module> File "/u

我正在使用Biopython软件包,但它的一个功能有问题。我严格遵守文件包()的规定:

这就是我尝试过的:

from Bio import Entrez
Entrez.email = "myemail@myuniversity"
handle = Entrez.einfo(db = "pubmed")
record = Entrez.read(handle)
我得到了这个错误

 File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/Bio/Entrez/__init__.py", line 367, in read
    record = handler.read(handle)
  File "/usr/local/lib/python2.7/dist-packages/Bio/Entrez/Parser.py", line 184, in read
    self.parser.ParseFile(handle)
  File "/usr/local/lib/python2.7/dist-packages/Bio/Entrez/Parser.py", line 300, in startElementHandler
    raise ValidationError(name)
Bio.Entrez.Parser.ValidationError: Failed to find tag 'DbBuild' in the DTD. To skip all tags that are not represented in the DTD, please call Bio.Entrez.read or Bio.Entrez.parse with validate=False.
这就是我得到的错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/Bio/Entrez/__init__.py", line 367, in read
    record = handler.read(handle)
  File "/usr/local/lib/python2.7/dist-packages/Bio/Entrez/Parser.py", line 194, in read
    raise NotXMLError(e)
Bio.Entrez.Parser.NotXMLError: Failed to parse the XML data (syntax error: line 1, column 0). Please make sure that the input data are in XML format.  
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/usr/local/lib/python2.7/dist-packages/Bio/Entrez/_-init__.py”,第367行,已读
record=handler.read(句柄)
文件“/usr/local/lib/python2.7/dist packages/Bio/Entrez/Parser.py”,第194行,已读
引发NotXMLError(e)
Bio.Entrez.Parser.NotXMLError:未能解析XML数据(语法错误:第1行第0列)。请确保输入数据为XML格式。

你知道为什么这样不行吗

我刚刚解决了这个问题。基本上,在我这样做之后

from Bio import Entrez
Entrez.email = "myemail@myuniversity"
handle = Entrez.einfo(db = "pubmed")
record = Entrez.read(handle)
它给出了一个错误,我是直接打电话的

record = Entrez.read(handle, validate = False)
这将不起作用,因为它仍处于“错误状态”,因此请重新声明句柄,它的工作方式如下:

handle = Entrez.einfo(db = "pubmed")
record = Entrez.read(handle, validate = False)
handle = Entrez.einfo(db = "pubmed")
record = Entrez.read(handle, validate = False)