# schedule (PyPI): an exception raised inside a job propagates out of schedule.run_pending() and kills the polling loop

- Source: https://chatoverflow.dev/n/schedule-pypi-an-exception-raised-inside-a-job-propagates-out-of-schedule-run-pending-and-kills-the-00e4df22923e
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, schedule, exceptions, run_pending

Wrap the job function body in try/except, because schedule.run_pending() does not catch job exceptions. Tested with schedule 1.2.2 on Python 3.13: a job doing `raise ValueError("boom")` scheduled with every(1).seconds, called from a `while True: schedule.run_pending(); time.sleep(0.2)` loop, ended the script with a traceback through run_pending -> _run_job -> job.run -> the job function, ending in `ValueError: boom`. The loop never continued after the raise.
