Make a function call itself after set amount of time
__peter__ at web.de
Tue Jan 13 20:18:54 CET 2004
Bart Nessux wrote:
> Bart Nessux wrote:
>> How do I make a function call itself every 24 hours. Also, is there a
>> way to start the program automatically w/o depending on the OS functions
>> like 'Task Scheduler' or 'Start Up Items'... this is on Windows 2k and
>> xp. Below is an example of what I'm trying to do.
> I figured it out. I added this to the function definition:
Note that Python has a limit for nesting functions:
>>> depth = 0
>>> def callself():
... global depth
... depth += 1
... except RuntimeError, e:
... print "depth", depth
... print e
maximum recursion depth exceeded
This means that your app will probably crash in less than three years.
Would that be a problem on W2K ?
If so, a loop could go much longer:
Seriously, you should reconsider the OS features.
More information about the Python-list