Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6973743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:08:50+00:00 2026-05-27T17:08:50+00:00

Consider this small piece of code from apscheduler.scheduler import Scheduler import time class First():

  • 0

Consider this small piece of code

from apscheduler.scheduler import Scheduler
import time

class First():
    def __init__(self):
        self.remove_job=None
    def go(self):
        self.remove_job('test')
class Sched():
    def __init__(self):
        self.sched = Scheduler()
        self.sched.add_interval_job(    self.execute,
                        seconds=1,
                        name = 'test'
                        )
    def execute(self):
        print "i'm alive"
    def remove_job(self,job):
        self.sched.print_jobs()
        self.sched.unschedule_job(job)

def main():
    first = First()
    sched = Sched()
    first.remove_job=sched.remove_job
    sched.sched.start()
    time.sleep(5)
    first.go()
    return 0

if __name__ == '__main__':
    main()

python sched_test.py 
i'm alive
i'm alive
i'm alive
i'm alive
i'm alive
Jobstore default:
    test (trigger: interval[0:00:01], next run at: 2011-12-22 01:25:36.577572)
Traceback (most recent call last):
  File "sched_test.py", line 55, in <module>
    main()
  File "sched_test.py", line 51, in main
    first.go()
  File "sched_test.py", line 31, in go
    self.remove_job('test')
  File "sched_test.py", line 43, in remove_job
    self.sched.unschedule_job(job)
  File "/usr/local/lib/python2.7/dist-packages/APScheduler-2.0.2-py2.7.egg/apscheduler/scheduler.py", line 401, in unschedule_job
    raise KeyError('Job "%s" is not scheduled in any job store' % job)
KeyError: 'Job "test" is not scheduled in any job store'

Why am I getting this error while printing out the jobs works?
print_jobs() gives me the right overview though.

Can someone shed some light on this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:08:51+00:00Added an answer on May 27, 2026 at 5:08 pm

    you must pass the job instance (returned by add_interval_job) to unschedule_job instead of a string.
    That fixes the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this piece of code: struct Trade { float Price; char* time; int shares;
I have a small isuse regarding an interface. Consider this code: [HttpPost()] public void
consider this code. when button is clicked 'active' class is added to this, and
Hy everyone, pls consider this small code, and help me to figure out, why
I've posted some questions on this before, but it's different. So consider a small
Do you consider this a code smell? foreach((array)$foo as $bar) { $bar->doStuff(); } Should
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) {
Consider this: public class TestClass { private String a; private String b; public TestClass()
consider this code block public void ManageInstalledComponentsUpdate() { IUpdateView view = new UpdaterForm(); BackgroundWorker
Consider this code (Java, specifically): public int doSomething() { doA(); try { doB(); }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.