This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Trying to do basic access of NCBI Entrez via Biopython

I am trying to follow the Biopython cookbook to do some basic access of Entrez, but it acts like there is something wrong, as I get:

ERROR:  [Errno 8] nodename nor servname provided, or not known

Here is my basic code:

from Bio import Entrez
import urllib2

try:
    handle = Entrez.einfo()
    result = handle.read()
    print result
except urllib2.HTTPError as e:
    # inform them of the specific error here (based off the error code)
    print "ERROR: ", e.code
except urllib2.URLError as e:
    # inform them of the specific error here
    print "ERROR: ", e.reason
except Exception as e:
    # inform them that a general error has occurred
    print "ERROR: ", e

Any ideas what could be the issue?

entrez ncbi biopython

1 answer

Your code works fine on my machine. Google search for that error suggests a more general problem with network access.

Thanks I did see an issue going on with DNS resolution. I would also like to add that I should have put an email in my example above like so:

Entrez.email = 'yourname@yourdomain.com'

Yes, this is normally just an intermittent network error, that will go away on its own.

Log in to answer this question.