How to schedule execution of code?

Tim Golden mail at timgolden.me.uk
Tue Mar 15 04:53:59 EDT 2011


On 15/03/2011 07:16, Virgil Stokes wrote:
> Suppose that I have some Python code (vers. 2.6) that has been converted
> into an *.exe file and can be executed on a Windows (Vista or 7)
> platform. What can one do to have this *.exe executed at a set of
> specific times each day?

Well, once you've got an .exe, the question isn't really Python-specific
any more. (Even without the .exe it's not really Python-specific...)
Use the Windows Scheduler. You can schedule a program to run at
certain times and on startup. When it fires up, it can check when
it was last run (by writing to a file / registry on firing up)
and deciding whether or not it needs to run.

The alternative is to have it install as a service and then run
its own scheduler loop, but that doesn't offer any real advantage:
you're just reinventing the Windows Task Scheduler.

TJG



More information about the Python-list mailing list