Re: [Tutor] : breaking out of a function that takes too long

2009-09-16 Thread Kent Johnson
On Wed, Sep 16, 2009 at 6:07 AM, C or L Smith wrote: >>> Serdar wrote: > ... >>> So again, is there a way to place a time limit on the execution of a >>> function, after which you can break out of it and then retry it or >>> move along with the rest of your program? > > At http://tinyurl.com/rbre9

[Tutor] : breaking out of a function that takes too long

2009-09-16 Thread C or L Smith
>> Serdar wrote: ... >> So again, is there a way to place a time limit on the execution of a >> function, after which you can break out of it and then retry it or >> move along with the rest of your program? At http://tinyurl.com/rbre9n you can find a recipe that tells you how to decorate a funct

Re: [Tutor] breaking out of a function that takes too long

2009-09-15 Thread Serdar Tumgoren
Thanks to all for the responses. I've never used threading, but from some initial googling it appears that it can indeed by tricky and there seem to be numerous recommendations against killing threads or processes. I'll explore the socket request libraries mentioned by several to see if that does

Re: [Tutor] breaking out of a function that takes too long

2009-09-15 Thread Luke Paireepinart
Most socket request libraries have timeouts on connection attempts, have you looked into that already? On Tue, Sep 15, 2009 at 4:02 PM, Serdar Tumgoren wrote: > Hey everyone, > Is there a way to break out of a function if it exceeds a certain time > limit for execution? > > There's a Website I'm

Re: [Tutor] breaking out of a function that takes too long

2009-09-15 Thread Kent Johnson
On Tue, Sep 15, 2009 at 5:02 PM, Serdar Tumgoren wrote: > Hey everyone, > Is there a way to break out of a function if it exceeds a certain time > limit for execution? In general this is tricky. It usually involves setting up another thread to run or monitor the function, then somehow terminating

Re: [Tutor] breaking out of a function that takes too long

2009-09-15 Thread Alan Gauld
"Serdar Tumgoren" wrote Is there a way to break out of a function if it exceeds a certain time limit for execution? Yes, you can put the call in a thread then in the main thread start a timer. If the timer expuires before the thread returns kill the thread.thread There's a Website I'm

[Tutor] breaking out of a function that takes too long

2009-09-15 Thread Serdar Tumgoren
Hey everyone, Is there a way to break out of a function if it exceeds a certain time limit for execution? There's a Website I'm scraping on a regular basis, and for some reason that I can't divine the site has radically varying response times. In some cases, I get a result vary quickly; at other t