apscheduler: LookupError: No trigger by the name "interval" was found
Originally reported by: Rodrigo Brim (Bitbucket: rodrigo_brim, GitHub: Unknown)
Hello.
I’m getting this error with OSX 10.9.4. The following lines describes my problem. Sorry if this is a stupid post.
#!bash
rbr:python rodrigo$ pip list | grep -i apscheduler
APScheduler (3.0.1)
rbr:python rodrigo$ cat ./schedule.py
#!python
#!/usr/bin/python
from datetime import datetime
import os
from apscheduler.schedulers.blocking import BlockingScheduler
def tick():
print('Tick! The time is: %s' % datetime.now())
if __name__ == '__main__':
scheduler = BlockingScheduler()
scheduler.add_job(tick, 'interval', seconds=3)
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
pass
#!bash
rbr:python rodrigo$ ./schedule.py
Traceback (most recent call last):
File "./schedule.py", line 14, in <module>
scheduler.add_job(tick, 'interval', seconds=3)
File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 330, in add_job
'trigger': self._create_trigger(trigger, trigger_args),
File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 782, in _create_trigger
return self._create_plugin_instance('trigger', trigger, trigger_args)
File "/Library/Python/2.7/site-packages/apscheduler/schedulers/base.py", line 766, in _create_plugin_instance
raise LookupError('No {0} by the name "{1}" was found'.format(type_, alias))
LookupError: No trigger by the name "interval" was found
rbr:python rodrigo$
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 26 (18 by maintainers)
Original comment by Alex Grönholm (Bitbucket: agronholm, GitHub: agronholm):
Give the instantiated trigger as the second parameter to add_job(). See http://apscheduler.readthedocs.org/en/latest/modules/schedulers/base.html#apscheduler.schedulers.base.BaseScheduler.add_job for further details.