why not schedule cron */5 * * * * and check in your code that previous execution was successful or not<br><br><div><br></div><div><br><div class="gmail_quote">On Wed, Sep 29, 2010 at 5:29 PM, harryos <span dir="ltr"><<a href="mailto:oswald.harry@gmail.com">oswald.harry@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">hi<br>
I am trying to write a program to read data from a site url.<br>
The program must read the data from site every 5 minutes.<br>
<br>
def get_data_from_site(pageurlstr):<br>
h=urllib.urlopen(pageurlstr)<br>
data=h.read()<br>
process_data(data)<br>
<br>
At first, I thought of using the sched module ,but then it doesn't<br>
look right adding so many scheduler.enter() statements.The program is<br>
supposed to execute the above function every<br>
5 minutes until the application is shut down by the user.<br>
<br>
I created an infinite loop<br>
while True:<br>
print time.asctime()<br>
get_data_from_site('<a href="http://somesite.com/" target="_blank">http://somesite.com/</a>')<br>
time.sleep(300)<br>
<br>
Is there a better way to do this?Any suggestions ,pointers most<br>
welcome<br>
thanks<br>
harry<br>
<font color="#888888">--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Nitin Pawar<br><br>
</div>