[BioPython] Problem with Entrez?

Sebastian Bassi sbassi at gmail.com
Sun Aug 24 22:18:09 UTC 2008


>>> handle = Entrez.efetch(db="nucleotide", id="326625")
>>> record = Entrez.read(handle)

Traceback (most recent call last):
  File "<pyshell#13>", line 1, in <module>
    record = Entrez.read(handle)
  File "/mnt/hda2/py252/lib/python2.5/site-packages/Bio/Entrez/__init__.py",
line 283, in read
    record = handler.run(handle)
  File "/mnt/hda2/py252/lib/python2.5/site-packages/Bio/Entrez/Parser.py",
line 95, in run
    self.parser.ParseFile(handle)
ExpatError: syntax error: line 1, column 0

So I efetch it again just to show the format of handle:

>>> handle = Entrez.efetch(db="nucleotide", id="326625")
>>> print handle.read()[:200]
Seq-entry ::= seq {
  id {
    genbank {
      name "HIVED82FO" ,
      accession "M77599" ,
      version 1 } ,
    gi 326625 } ,
  descr {
    title "Human immunodeficiency virus type 1 gp120 (env)

Looks like ASN1 format, but according to the tutorial efetch should
return its output in XML format:
"By default you get the output in XML format, which you can parse
using the Bio.Entrez.read() function "

As a workaround I specify the format with  rettype='gb'



More information about the Biopython mailing list