[Tutor] Stopping function after given time

Raduz raduzator at volny.cz
Tue Oct 11 10:05:58 CEST 2005


On Monday 10 of October 2005 20:10, Oliver Maunder wrote:
> > >Simple question: Is it possible to stop a running function after certain
> > >predefined time?
> > >
> > >I would like to convert this routine to Python using pycurl module, or
> >
> > maybe
> >
> > >even standard urllib.urlretrieve.
>
> If you use urllib.urlretrieve, you can pass in a callback function that
> gets called after every few blocks are downloaded. In that function, you
> could check how much time has passed since the download started, and quit
> the download if necessary. You should be able to do this without threads.
> I'm not sure how you stop a download once it's started though!
>
> Olly

Thanks for an idea, I will look into it. I'm not sure how to stop running 
download, but at least I have something to start with :-)

-- 
Raduz


More information about the Tutor mailing list