cronex

raw JSON →
0.1.3.1 verified Mon Apr 27 auth: no python maintenance

Provides an easy-to-use interface for cron-like task scheduling. Version 0.1.3.1. Release cadence is low, no recent updates.

pip install cronex
error AttributeError: module 'cronex' has no attribute 'CronEx'
cause Using 'import cronex' and then 'cronex.CronEx' when CronEx is not a module-level attribute.
fix
Use 'from cronex import CronEx'.
error ValueError: invalid literal for int() with base 10: ''
cause Passing an empty string or malformed cron expression to CronEx.
fix
Ensure the cron expression is a valid 5-field string like '*/5 * * * *'.
breaking The package is no longer actively maintained. It may not work with newer Python versions beyond 3.x.
fix Consider alternatives like 'croniter' or 'python-crontab'.
gotcha The test() method only works with minute-level granularity. It does not support seconds.
fix Ensure your cron expression has 5 fields (minute hour day month weekday).
gotcha The library does not handle timezones. All times are assumed to be local.
fix Manually convert times to local timezone before using.

Create a CronEx instance with a cron expression and call test() to check if the current time matches.

import time
from cronex import CronEx

cron = CronEx('*/5 * * * *')
while True:
    if cron.test():
        print("Task triggered")
    time.sleep(60)