[Biopython] Problem with Bio.Entrez...
Michiel de Hoon
mjldehoon at yahoo.com
Thu Aug 26 22:40:52 EDT 2010
The problem is with the XML returned by NCBI.
Currently, the XML returned by einfo contains <Docsum> elements that are not described in the corresponding DTD (http://www.ncbi.nlm.nih.gov/entrez/query/DTD/eInfo_020511.dtd). The parser therefore doesn't know how to handle them.
Could you write an email to NCBI that einfo generates XML that is inconsistent with the corresponding DTD?
Best,
--Michiel.
--- On Thu, 8/26/10, Nathan J. Edwards <nje5 at georgetown.edu> wrote:
> From: Nathan J. Edwards <nje5 at georgetown.edu>
> Subject: [Biopython] Problem with Bio.Entrez...
> To: biopython at lists.open-bio.org
> Date: Thursday, August 26, 2010, 9:43 PM
>
> Seems to be a problem with Entrez XML parsing:
>
> from Bio import Entrez
> Entrez.email = 'xxxyy at georgetown.edu'
>
> handle = Entrez.einfo(db='pubmed')
> result = Entrez.read(handle)
>
> results in:
>
> Traceback (most recent call last):
> File "C:/Documents and Settings/Nathan/My
> Documents/BCHB524/testing.py", line 5, in <module>
> result = Entrez.read(handle)
> File
> "C:\BCHB524-2010\Python26\lib\site-packages\Bio\Entrez\__init__.py",
> line 261, in read
> record = handler.read(handle)
> File
> "C:\BCHB524-2010\Python26\lib\site-packages\Bio\Entrez\Parser.py",
> line 150, in read
> self.parser.ParseFile(handle)
> File
> "C:\BCHB524-2010\Python26\lib\site-packages\Bio\Entrez\Parser.py",
> line 295, in endElementHandler
> current[name] = value
> TypeError: 'str' object does not support item assignment
>
> error is in Parser.endElementHandler:
>
> current =
> self.stack[-1]
> try:
>
> current.append(value)
> except
> AttributeError:
> 295: current[name]
> = value
>
> because current is the empty string "".
>
> The problem is probably that the empty string shouldn't be
> on the stack, given the logic here and elsewhere, but a
> simple test for the empty string does get things working
> again.
>
> current =
> self.stack[-1]
> if current == "":
> return
> try:
>
> current.append(value)
> except
> AttributeError:
> 295: current[name]
> = value
>
>
> Cheers!
>
> - n
>
> -- Dr. Nathan Edwards
> nje5 at georgetown.edu
> Department of Biochemistry and Molecular & Cellular
> Biology
> Georgetown
> University Medical Center
> Room 1215, Harris Building
> Room 347, Basic Science
> 3300 Whitehaven St, NW
> 3900 Reservoir Road, NW
> Washington DC 20007
> Washington DC
> 20007
> Phone: 202-687-7042
> Phone:
> 202-687-1618
> Fax: 202-687-0057
> Fax:
> 202-687-7186
> _______________________________________________
> Biopython mailing list - Biopython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>
More information about the Biopython
mailing list