Autorun python script from python
Question: I wrote a python script that downloads a random picture from
[APOD](http://apod.nasa.gov/apod/astropix.html). I want to be able to specify
the update frequency in python and have python automatically run the script.
So the program would look something like this:

    
    
    //first setup
    print "how often should the background change in hours?"
    updatefrequency = input()
    schedule_autorun(updatefrequency)
    //run each time
    runprogram()
    

I've seen that people have used the windows task scheduler to auto run the
program, but I would like to set it from python. I am running python 2.7 on
Windows 7


Answer: How about the time module?

    
    
    import time
    timeinseconds = 100000
    while(1):
        time.sleep(timeinseconds)
        runProgram()
    

If the time it takes to run the program exceeds your wait time, you can also
call it as a separate process.

    
    
    from subprocess import call
    call(['python','runProgram.py'])
    

or subprocess.Popen

