[Biopython-dev] [Bug 3006] New: esearch medline fails with xml format
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Mon Feb 8 17:08:33 UTC 2010
http://bugzilla.open-bio.org/show_bug.cgi?id=3006
Summary: esearch medline fails with xml format
Product: Biopython
Version: Not Applicable
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: normal
Priority: P2
Component: Main Distribution
AssignedTo: biopython-dev at biopython.org
ReportedBy: georg.lipps at fhnw.ch
I used to retrieve Pubmed records with python 2.5.1 however lately the efetch
with xml produces an error. The problem has arosen at the year change maybe
related to the DTD definition file:
Here is a short code which produces the error:
from Bio import Entrez
from Bio import Medline
def retrieve_medline(doi):
# Uses the doi to obtain the medline id and then retrieves the medline
entry
# Returns the medline entry as text and python object or an empty string
print "...queing medline with DOI", doi
handle = Entrez.esearch(db="pubmed", term=doi, retmode="XML")
record=Entrez.read(handle)
if record["Count"]<>"1":
return None, None
handle=Entrez.efetch(db="pubmed", id=record["IdList"], retmode="text",
rettype="medline")
xml=Entrez.efetch(db="pubmed", id=record["IdList"], retmode="XML",
rettype="medline")
return handle.read(), Entrez.read(xml)
doi='10.1038/nature07389'
article, xml=retrieve_medline(doi)
print article
OUTPUT:
Traceback (most recent call last):
File "U:/Literatur/pdf to RM converter/test.py", line 24, in <module>
article, xml=retrieve_medline(doi)
File "U:/Literatur/pdf to RM converter/test.py", line 15, in retrieve_medline
return handle.read(), Entrez.read(xml)
File "C:\Program Files\python25\lib\site-packages\Bio\Entrez\__init__.py",
line 283, in read
record = handler.run(handle)
File "C:\Program Files\python25\lib\site-packages\Bio\Entrez\Parser.py", line
95, in run
self.parser.ParseFile(handle)
File "C:\Program Files\python25\lib\site-packages\Bio\Entrez\Parser.py", line
131, in startElement
return
UnboundLocalError: local variable 'object' referenced before assignment
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list