On 07/27/2011 08:35 AM, Chris Angelico wrote:
On Wed, Jul 27, 2011 at 10:27 PM, Dave Angel<da...@ieee.org>  wrote:
As Chris pointed out, you probably aren't getting the script's directory
right.  After all, how can the scheduler guess where you put it?  The
obvious answer is to use a full path for the script's filename.  Another
alternative is to fill in the current directory in the appropriate field of
the scheduler's entry.

I would prefer setting the current directory, as that allows the
script to find any data files it needs, but either works.

I find it useful to only add batch files to the scheduler.  Those batch
files can do any setup and cleanup necessary.  In this case, the batch file
might simply set the current directory to the location of the script.

And that is an excellent idea. Definitely recommended.

ChrisA

If it hasn't been mentioned already:

import time

while True:
    t1 = time.time()

    #your code here

    t2 = time.time()
    time.sleep( 86400 - (t2 - t1) )



This doesn't take into account leap seconds, but it doesn't depend on a task scheduler. It is also independent of the time your code takes to execute.

This is simpler, but it might drift slightly over time.

--
Bill
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to