[BioPython] GenBank.NCBIDictionary 'Operation timed out'

David Moreira david.moreira at u-psud.fr
Wed May 14 05:26:13 EDT 2008


Dear all,

I have a problem when using the GenBank.NCBIDictionary to retrieve 
sequences from GenBank. Quite often my script finishes with an error due 
to a too long connexion time:

urllib2.URLError: <urlopen error <10060, 'Operation timed out'>>

The code I am using is very simple, I have tried to avoid the problem by 
waiting 10 seconds before retrying, but it does not work:

def retrieve_taxonomy_seq(acc_number):
    # retrieve the sequence from GenBank
    try:
        ncbi_dict = GenBank.NCBIDictionary(database="nucleotide", 
format="genbank")
    # exception in case of network problems    
    except IOError:
        print "Network down, waiting 10 seconds before continuing"
        time.sleep(10)
        retrieve_taxonomy(acc_number)

I have to use this function about ~100 times. I know that the best would 
be to have a local data base to avoid Internet connexion problems, but 
by some practical reasons I prefer to go directly to GenBank for my search.

Do you have any suggestion to avoid this problem?

Best,

David


-- 
David MOREIRA 
Unité d'Ecologie, Systématique et Evolution - UMR CNRS 8079
Université Paris-Sud. Bâtiment 360. 91405 Orsay CEDEX. FRANCE
Tel: 33 1 69 15 76 08     Fax: 33 1 69 15 46 97 
http://www.ese.u-psud.fr/microbiologie/



More information about the BioPython mailing list