summaryrefslogtreecommitdiff
path: root/examples/misc/reference.py
blob: 1479d2ff68c8aab0934dd260176dda6254fb07d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""
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+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))

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