Hi,

I m a newbiee to python, I would like to write one program, and i want that program should run automatically when my system time is 10 am.

Is it possible to do it, if so can any one throw a light to help me
Any kind of help is welcome

thx
sree

There are a few options depending on your Operating System, and how you want the script to behave. There is no way for Python to just know it's a certain time, unless it is currently running. So, the first option is to have the script running constantly, and just perform the operations you desire at the particular time.

import time

while 1:
	if time.strftime("%H") == "10" and time.strftime("%M") == "00":
		print "Do Whatever you want here"
		time.sleep(60)

I made it sleep for 60 seconds in case whatever operation you want to perform doesn't last for a whole minute, you don't want it repeating. This script will print the string "Do Whatever you want here" every day at 10 am, until it dies.

A better way to implement this is probably to use the OS specific tools, such as scheduled tasks on windows.

Here is a link:
http://support.microsoft.com/kb/308569

Hi
Thanks for ur reply

After i posted query here, i tried googling and found the solution with the windows scheduler task.

anyway thx a ton
sree

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.