diff options
| author | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-05-28 00:42:54 +0300 |
|---|---|---|
| committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-05-28 00:42:54 +0300 |
| commit | 3d6b2df25ef27d4ce07996ccd87bf3f028a180ff (patch) | |
| tree | 4bdb7e0c00788ca76842be7f3c091d3518e424fc /examples | |
| parent | 5b70755bdb9531cc784c64cd4bf9d4d3d38ba7ab (diff) | |
| download | apscheduler-3d6b2df25ef27d4ce07996ccd87bf3f028a180ff.tar.gz | |
Fixed OverflowError on Windows
Instruct users to use Ctrl+Break on Windows rather than Ctrl+C
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/executors/processpool.py | 3 | ||||
| -rw-r--r-- | examples/jobstores/mongodb.py | 3 | ||||
| -rw-r--r-- | examples/jobstores/redis_.py | 3 | ||||
| -rw-r--r-- | examples/jobstores/sqlalchemy_.py | 3 | ||||
| -rw-r--r-- | examples/misc/reference.py | 4 | ||||
| -rw-r--r-- | examples/schedulers/asyncio_.py | 5 | ||||
| -rw-r--r-- | examples/schedulers/background.py | 3 | ||||
| -rw-r--r-- | examples/schedulers/blocking.py | 3 | ||||
| -rw-r--r-- | examples/schedulers/gevent_.py | 5 | ||||
| -rw-r--r-- | examples/schedulers/tornado_.py | 5 | ||||
| -rw-r--r-- | examples/schedulers/twisted_.py | 5 |
11 files changed, 27 insertions, 15 deletions
diff --git a/examples/executors/processpool.py b/examples/executors/processpool.py index 3cabdb2..b8988df 100644 --- a/examples/executors/processpool.py +++ b/examples/executors/processpool.py @@ -3,6 +3,7 @@ Demonstrates how to schedule a job to be run in a process pool on 3 second inter """ from datetime import datetime +import os from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.executors.pool import PoolExecutor @@ -16,7 +17,7 @@ if __name__ == '__main__': scheduler = BlockingScheduler() scheduler.add_executor(PoolExecutor('process')) scheduler.add_job(tick, 'interval', seconds=3) - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/jobstores/mongodb.py b/examples/jobstores/mongodb.py index 1da2513..36a09e0 100644 --- a/examples/jobstores/mongodb.py +++ b/examples/jobstores/mongodb.py @@ -7,6 +7,7 @@ Running the example with the --clear switch will remove any existing alarms. from datetime import datetime, timedelta import sys +import os from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.jobstores.mongodb import MongoDBJobStore @@ -26,7 +27,7 @@ if __name__ == '__main__': alarm_time = datetime.now() + timedelta(seconds=10) scheduler.add_job(alarm, 'date', run_date=alarm_time, args=[datetime.now()]) print('To clear the alarms, run this example with the --clear argument.') - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/jobstores/redis_.py b/examples/jobstores/redis_.py index 8236e5c..13f6251 100644 --- a/examples/jobstores/redis_.py +++ b/examples/jobstores/redis_.py @@ -7,6 +7,7 @@ Running the example with the --clear switch will remove any existing alarms. from datetime import datetime, timedelta import sys +import os from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.jobstores.redis import RedisJobStore @@ -26,7 +27,7 @@ if __name__ == '__main__': alarm_time = datetime.now() + timedelta(seconds=10) scheduler.add_job(alarm, 'date', run_date=alarm_time, args=[datetime.now()]) print('To clear the alarms, run this example with the --clear argument.') - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/jobstores/sqlalchemy_.py b/examples/jobstores/sqlalchemy_.py index 1741ce2..8951844 100644 --- a/examples/jobstores/sqlalchemy_.py +++ b/examples/jobstores/sqlalchemy_.py @@ -7,6 +7,7 @@ You can also give it the database URL as an argument. See the SQLAlchemy documen from datetime import datetime, timedelta import sys +import os from apscheduler.schedulers.blocking import BlockingScheduler from apscheduler.jobstores.sqlalchemy import SQLAlchemyJobStore @@ -23,7 +24,7 @@ if __name__ == '__main__': alarm_time = datetime.now() + timedelta(seconds=10) scheduler.add_job(alarm, 'date', run_date=alarm_time, args=[datetime.now()]) print('To clear the alarms, delete the example.sqlite file.') - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/misc/reference.py b/examples/misc/reference.py index 90401f1..f6fc5dd 100644 --- a/examples/misc/reference.py +++ b/examples/misc/reference.py @@ -2,13 +2,15 @@ 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+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/schedulers/asyncio_.py b/examples/schedulers/asyncio_.py index 9d0cc7e..a5d6373 100644 --- a/examples/schedulers/asyncio_.py +++ b/examples/schedulers/asyncio_.py @@ -4,6 +4,7 @@ Demonstrates how to use the Tornado compatible scheduler to schedule a job that from datetime import datetime import asyncio +import os from apscheduler.schedulers.asyncio import AsyncIOScheduler @@ -16,9 +17,9 @@ if __name__ == '__main__': scheduler = AsyncIOScheduler() scheduler.add_job(tick, 'interval', seconds=3) scheduler.start() - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) - # Execution will block here until Ctrl+C is pressed. + # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed. try: asyncio.get_event_loop().run_forever() except (KeyboardInterrupt, SystemExit): diff --git a/examples/schedulers/background.py b/examples/schedulers/background.py index 20cbbba..59a1eed 100644 --- a/examples/schedulers/background.py +++ b/examples/schedulers/background.py @@ -4,6 +4,7 @@ Demonstrates how to use the background scheduler to schedule a job that executes from datetime import datetime import time +import os from apscheduler.schedulers.background import BackgroundScheduler @@ -16,7 +17,7 @@ if __name__ == '__main__': scheduler = BackgroundScheduler() scheduler.add_job(tick, 'interval', seconds=3) scheduler.start() - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: # This is here to simulate application activity (which keeps the main thread alive). diff --git a/examples/schedulers/blocking.py b/examples/schedulers/blocking.py index 89b4060..31b1783 100644 --- a/examples/schedulers/blocking.py +++ b/examples/schedulers/blocking.py @@ -3,6 +3,7 @@ Demonstrates how to use the blocking scheduler to schedule a job that executes o """ from datetime import datetime +import os from apscheduler.schedulers.blocking import BlockingScheduler @@ -14,7 +15,7 @@ def tick(): if __name__ == '__main__': scheduler = BlockingScheduler() scheduler.add_job(tick, 'interval', seconds=3) - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) try: scheduler.start() diff --git a/examples/schedulers/gevent_.py b/examples/schedulers/gevent_.py index c9956b9..e51e5bb 100644 --- a/examples/schedulers/gevent_.py +++ b/examples/schedulers/gevent_.py @@ -3,6 +3,7 @@ Demonstrates how to use the gevent compatible scheduler to schedule a job that e """ from datetime import datetime +import os from apscheduler.schedulers.gevent import GeventScheduler @@ -15,9 +16,9 @@ if __name__ == '__main__': scheduler = GeventScheduler() scheduler.add_job(tick, 'interval', seconds=3) g = scheduler.start() # g is the greenlet that runs the scheduler loop - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) - # Execution will block here until Ctrl+C is pressed. + # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed. try: g.join() except (KeyboardInterrupt, SystemExit): diff --git a/examples/schedulers/tornado_.py b/examples/schedulers/tornado_.py index 00831c0..f839d0d 100644 --- a/examples/schedulers/tornado_.py +++ b/examples/schedulers/tornado_.py @@ -3,6 +3,7 @@ Demonstrates how to use the Tornado compatible scheduler to schedule a job that """ from datetime import datetime +import os from tornado.ioloop import IOLoop from apscheduler.schedulers.tornado import TornadoScheduler @@ -16,9 +17,9 @@ if __name__ == '__main__': scheduler = TornadoScheduler() scheduler.add_job(tick, 'interval', seconds=3) scheduler.start() - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) - # Execution will block here until Ctrl+C is pressed. + # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed. try: IOLoop.instance().start() except (KeyboardInterrupt, SystemExit): diff --git a/examples/schedulers/twisted_.py b/examples/schedulers/twisted_.py index 3c69eb1..d63f06d 100644 --- a/examples/schedulers/twisted_.py +++ b/examples/schedulers/twisted_.py @@ -3,6 +3,7 @@ Demonstrates how to use the Twisted compatible scheduler to schedule a job that """ from datetime import datetime +import os from twisted.internet import reactor from apscheduler.schedulers.twisted import TwistedScheduler @@ -16,9 +17,9 @@ if __name__ == '__main__': scheduler = TwistedScheduler() scheduler.add_job(tick, 'interval', seconds=3) scheduler.start() - print('Press Ctrl+C to exit') + print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C')) - # Execution will block here until Ctrl+C is pressed. + # Execution will block here until Ctrl+C (Ctrl+Break on Windows) is pressed. try: reactor.run() except (KeyboardInterrupt, SystemExit): |
