File: reference.py

package info (click to toggle)
apscheduler 3.11.2-1
  • links: PTS
  • area: main
  • in suites: sid
  • size: 872 kB
  • sloc: python: 7,326; makefile: 6
file content (17 lines) | stat: -rw-r--r-- 476 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""
Basic example showing how to schedule a callable using a textual reference.
"""

import os

from apscheduler.schedulers.blocking import BlockingScheduler

if __name__ == "__main__":
    scheduler = BlockingScheduler()
    scheduler.add_job("sys:stdout.write", "interval", seconds=3, args=["tick\n"])
    print("Press Ctrl+{} to exit".format("Break" if os.name == "nt" else "C"))

    try:
        scheduler.start()
    except (KeyboardInterrupt, SystemExit):
        pass