Re: scheduler or infinite loop

2010-09-29 Thread John Nagle
On 9/29/2010 4:59 AM, harryos wrote: hi I am trying to write a program to read data from a site url. The program must read the data from site every 5 minutes. def get_data_from_site(pageurlstr): h=urllib.urlopen(pageurlstr) data=h.read() process_data(data) A key point here is

Re: scheduler or infinite loop

2010-09-29 Thread Frank Millman
harryos wrote Here is a technique that allows the loop to run in the background, in its own thread, leaving the main program to do other processing - import threading class DataGetter(threading.Thread): thanks Frank A pleasure. I left out a line that will usually be desirable. At the e

Re: scheduler or infinite loop

2010-09-29 Thread harryos
thanks Frank > > Here is a technique that allows the loop to run in the background, in its > own thread, leaving the main program to do other processing - > > import threading > > class DataGetter(threading.Thread): > -- http://mail.python.org/mailman/listinfo/python-list

Re: scheduler or infinite loop

2010-09-29 Thread Frank Millman
harryos wrote: hi I am trying to write a program to read data from a site url. The program must read the data from site every 5 minutes. def get_data_from_site(pageurlstr): h=urllib.urlopen(pageurlstr) data=h.read() process_data(data) At first, I thought of using the sched module ,bu

Re: scheduler or infinite loop

2010-09-29 Thread Nitin Pawar
why not schedule cron */5 * * * * and check in your code that previous execution was successful or not On Wed, Sep 29, 2010 at 5:29 PM, harryos wrote: > hi > I am trying to write a program to read data from a site url. > The program must read the data from site every 5 minutes. > > def get_dat

scheduler or infinite loop

2010-09-29 Thread harryos
hi I am trying to write a program to read data from a site url. The program must read the data from site every 5 minutes. def get_data_from_site(pageurlstr): h=urllib.urlopen(pageurlstr) data=h.read() process_data(data) At first, I thought of using the sched module ,but then it doesn'