[Biopython] help with ncbiWWW
Jocelyne
jocelyne at gmail.com
Wed Jul 26 20:27:59 UTC 2017
I allowed up to 3 timeouts, with a sleep in between tries. But I
issued my own requests with urllib2 (requests is probably easier to
use). It was the Entrez database, not blast server, but the issue was
similar. It would hang indefinitely.
On Wed, Jul 26, 2017 at 1:21 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> If there is an exception, sure :)
>
> Perhaps I misunderstood, but I thought here there was no
> exception - the loop just keeps happening - checking the
> NCBI every two minutes but not ending.
>
> Peter
>
>
> On Wed, Jul 26, 2017 at 8:50 PM, Jocelyne <jocelyne at gmail.com> wrote:
>> FYI, I ran into the same issue and had to have try catch with a timeout on
>> the request. I think Nabeel's explanation should cover it. Note that
>> catching request timeout exceptions in python 2 is a bit of a pain...
>>
>> --sent from my not-so-new-yet-still-awesome galaxy note edge
>>
>> On Jul 26, 2017 11:50, "Peter Cock" <p.j.a.cock at googlemail.com> wrote:
>>>
>>> Hi Pej.
>>>
>>> Hmm. Maybe setting the timeout is not going to solve your
>>> problem. I was hoping that would be a neat solution.
>>>
>>> Can you show us the stack trace when you had to stop a job
>>> please?
>>>
>>> I assume you are using control+c to do this, in which case
>>> Python ought to stop with the exception KeyboardInterrupt.
>>> What I am interested in here is where in the code Python
>>> is getting stuck. That would be a good clue.
>>>
>>> Peter
>>>
>>> On Wed, Jul 26, 2017 at 2:47 PM, Pejvak Moghimi
>>> <pejvak.moghimi at york.ac.uk> wrote:
>>> > Hi Peter,
>>> >
>>> > That solution, so far, does not seem to have worked nor with 10 neither
>>> > with
>>> > 30 second options.
>>> >
>>> > Cheers,
>>> > Pej.
>>> >
>>> > On 26 July 2017 at 13:29, Peter Cock <p.j.a.cock at googlemail.com> wrote:
>>> >>
>>> >> I am hoping that putting this near the start of your script will
>>> >> apply the default timeout to all your BLAST calls (or other
>>> >> network calls, e.g. NCBI Entrez):
>>> >>
>>> >> import socket
>>> >> socket.setdefaulttimeout(30) # timeout in seconds
>>> >>
>>> >> Peter
>>> _______________________________________________
>>> Biopython mailing list - Biopython at mailman.open-bio.org
>>> http://mailman.open-bio.org/mailman/listinfo/biopython
More information about the Biopython
mailing list