text: user12370: I'm trying to use Entrez (through Biopython) to download the sequence of a TMV replicase gene.
  I have the following code:
  # Lookup ID
  search = Entrez.esearch(db='gene', term='Tobacco mosaic virus[Orgn] AND replicase')
  read = Entrez.read(search)
  idlist = read["IdList"]
  
  # Fetch sequence
  search = Entrez.efetch(db='gene', id=idlist[0], retmode='text', rettype='gb')
  read = SeqIO.read(search, "genbank")
  tmv_replicase = read.seq
  
  But when I run it it throws the exception on the SeqIO.read line: ValueError: No records found in handle.
  The IDs provided in idlist are: ['1494081', '1494082'].
  
  user4992: Did you try to fetch from the database nucleotide instead of gene ?
  # load modules
  from Bio import SeqIO
  from Bio import Entrez
  
  # Lookup ID
  search = Entrez.esearch(db='nucleotide', term='Tobacco mosaic virus[Orgn] AND replicase')
  read = Entrez.read(search)
  idlist = read["IdList"]
  
  # Fetch sequence
  search = Entrez.efetch(db='nucleotide', id=idlist[0], retmode='text', rettype='gb')
  read = SeqIO.read(search, "genbank")
  tmv_replicase = read.seq
  
  It returns
  >>> read
  SeqRecord(seq=Seq('GTATTTTTACAACAATTACCAACAACAACAAACAACAAACAACATTACAATTAC...GGG'), id='MN912489.1', name='MN912489', description='Tobacco mosaic virus isolate TMV:BR:SC:02:01, complete genome', dbxrefs=[])
  >>> tmv_replicase
  Seq('GTATTTTTACAACAATTACCAACAACAACAAACAACAAACAACATTACAATTAC...GGG')
  
  
  
original_text: 12370: <p>I'm trying to use Entrez (through Biopython) to download the sequence of a TMV replicase gene.</p>
  <p>I have the following code:</p>
  <pre class="lang-py prettyprint-override"><code># Lookup ID
  search = Entrez.esearch(db='gene', term='Tobacco mosaic virus[Orgn] AND replicase')
  read = Entrez.read(search)
  idlist = read[&quot;IdList&quot;]
  
  # Fetch sequence
  search = Entrez.efetch(db='gene', id=idlist[0], retmode='text', rettype='gb')
  read = SeqIO.read(search, &quot;genbank&quot;)
  tmv_replicase = read.seq
  </code></pre>
  <p>But when I run it it throws the exception on the <code>SeqIO.read</code> line: <code>ValueError: No records found in handle</code>.</p>
  <p>The IDs provided in idlist are: <code>['1494081', '1494082']</code>.</p>
   4992: <p>Did you try to fetch from the database <code>nucleotide</code> instead of <code>gene</code> ?</p>
  <pre><code># load modules
  from Bio import SeqIO
  from Bio import Entrez
  
  # Lookup ID
  search = Entrez.esearch(db='nucleotide', term='Tobacco mosaic virus[Orgn] AND replicase')
  read = Entrez.read(search)
  idlist = read[&quot;IdList&quot;]
  
  # Fetch sequence
  search = Entrez.efetch(db='nucleotide', id=idlist[0], retmode='text', rettype='gb')
  read = SeqIO.read(search, &quot;genbank&quot;)
  tmv_replicase = read.seq
  </code></pre>
  <p>It returns</p>
  <pre><code>&gt;&gt;&gt; read
  SeqRecord(seq=Seq('GTATTTTTACAACAATTACCAACAACAACAAACAACAAACAACATTACAATTAC...GGG'), id='MN912489.1', name='MN912489', description='Tobacco mosaic virus isolate TMV:BR:SC:02:01, complete genome', dbxrefs=[])
  &gt;&gt;&gt; tmv_replicase
  Seq('GTATTTTTACAACAATTACCAACAACAACAAACAACAAACAACATTACAATTAC...GGG')
  
  </code></pre>
  