The `crontab` library (from the `josiahcarlson/parse-crontab` project) is a Python package designed to parse crontab schedule entries and determine the next execution time. It calculates delays in seconds until a scheduled event. The current version is 1.0.5, with sporadic but active development and releases.
pip install crontabVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a cron string and calculate its next execution time using the `CronTab` class. It uses `datetime` and `timedelta` to convert the returned delay in seconds into an absolute datetime object.
Verify the library's functionality on its PyPI page or GitHub repository, and explicitly install `crontab` for parsing or `python-crontab` for system management if that's what you need.
Avoid using unsupported symbols. Ensure your cron expressions adhere to the 5-7 field format compatible with standard Unix cron, noting the library's specific interpretation.
Use absolute paths for scripts, commands, and any files accessed. Explicitly set `PATH` and activate virtual environments within the cron job definition. Redirect stdout/stderr to log files for debugging.
Install the library using pip: `pip install parse-crontab`
Instantiate `CronTab` with a valid crontab string, for example: `from crontab import CronTab; cron = CronTab('* * * * *')`If `CronSlices` functionality is desired, install and use the `python-crontab` library (`pip install python-crontab`). If the intention was to use `josiahcarlson/parse-crontab`, revise the code to use its `CronTab` class and its available methods.
Correct the crontab expression to comply with the supported syntax and value ranges of the `josiahcarlson/parse-crontab` library. Consult the library's documentation for valid formats.
No dependency data recorded yet.