Minecraft_Json
Minecraft_Json

Reputation: 247

How do I schedule tasks on Windows using Python?

I have the following code:

import schedule
import time

def job(t):
    print "I'm working...", t
    return

schedule.every().sunday.at("01:00").do(job,'It is sonday 01:00')

while True:
    schedule.run_pending()
    time.sleep(60) # wait one minute

How can I make sure the code works when my PC is off or when the code is not running?

I don't know if my question is weird but with schedule, we should be able to repeat the event. And I think it is just the case as long as the code is running.

Or easy, what happens when the code is not running and/or my pc is off?

Upvotes: 0

Views: 249

Answers (1)

balderman
balderman

Reputation: 23815

Use the OS scheduler. In case of windows - go with https://www.windowscentral.com/how-create-automated-task-using-task-scheduler-windows-10

Upvotes: 1

Related Questions