Python Forum
Cancelling previous schedule
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cancelling previous schedule
#2
(Sep-14-2021, 07:48 PM)cosmarchy Wrote: Is there something going on in the background with schedule which is not being closed down?
Yes you have to use Ctrl+c to shut it down.
Your second code with schedule is line 7 wrong.
Code will not run with that error,look at Cancel a job doc
So a example run.
import schedule
import time

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

schedule.every(10).seconds.do(job)
while 1:
   schedule.run_pending()
   time.sleep(1)
Output:
G:\div_code\answer λ python 10_sec.py I'm working... I'm working... I'm working... I'm working... Traceback (most recent call last): File "G:\div_code\answer\10_sec.py", line 10, in <module> time.sleep(1) KeyboardInterrupt ^C
In background there will a process python.exe(python on Linux) running which has a own pid.
If want to see processes in background eg shut down from Python look at psutil.
Reply


Messages In This Thread
Cancelling previous schedule - by cosmarchy - Sep-14-2021, 07:48 PM
RE: Cancelling previous schedule - by snippsat - Sep-15-2021, 11:26 AM
RE: Cancelling previous schedule - by Larz60+ - Sep-15-2021, 04:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Schedule exit a program at a specific time 4 am every day. chubbychub 3 341 May-17-2024, 03:45 PM
Last Post: chubbychub
  Hosting a script on a VPS, and on a schedule? oldguy 0 3,022 Mar-13-2021, 02:46 AM
Last Post: oldguy
  Cancelling 'open directory' leading to crash Fairbz_ 1 2,250 May-08-2020, 03:14 PM
Last Post: DPaul
  something i noticed about the "schedule" module Stan2292 1 1,836 Aug-30-2019, 06:04 AM
Last Post: buran
  How to schedule Jupyter Notebooks with Papermill wendysling 0 2,557 Jun-11-2019, 05:53 PM
Last Post: wendysling
  schedule module conundrum wgovideo 11 4,509 May-29-2019, 06:39 PM
Last Post: wgovideo
  I got a problem with python schedule darktitan 2 3,575 Sep-22-2018, 12:49 PM
Last Post: darktitan
  Schedule with other processing RValentim 7 4,121 Jul-10-2018, 12:57 PM
Last Post: RValentim
  How to convert Schedule to APScheduler module? penguin9 2 3,881 May-03-2018, 12:44 PM
Last Post: penguin9
  Creating a schedule program ndplokkaar 4 4,059 Nov-23-2017, 04:21 PM
Last Post: ndplokkaar

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020