[Biopython] Problem with Bio.Entrez...
Nathan J. Edwards
nje5 at georgetown.edu
Thu Aug 26 21:43:08 EDT 2010
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
More information about the Biopython
mailing list