0

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?

6
  • which OS you use? (Windows/Linux/Other) Commented Sep 13, 2021 at 10:06
  • @balderman Windows Commented Sep 13, 2021 at 10:28
  • 2
    @UserOfStackOverFlow please do not advise users deleting their posts, especially if their posts have answers. You are essentially setting them for a post ban. See Meta FAQ for details. On an off-note, the comment text would benefit from being phrased in a friendlier way. Commented Sep 15, 2021 at 17:31
  • 1
    @UserOfStackOverFlow I consider the comment you posted to not only be unkind, but it's also misleading. Commented Sep 15, 2021 at 18:24
  • 1
    @Scratte Not was my intention. Give an upvote for the answer to help future searchers. Commented Sep 15, 2021 at 18:35

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.