Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron expression with '?' in Day-of-month and Day-of-Week throws CroniterNotAlphaError exception #51

Open
kavilakshmi opened this issue Sep 12, 2023 · 2 comments

Comments

@kavilakshmi
Copy link

`from datetime import datetime
from croniter import croniter

it = croniter("0/3 * * * ? *", datetime(2021, 1, 1))
for i in range(0, 15):
print(it.get_next(datetime).isoformat())
`

Result :
Traceback (most recent call last):
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-engine/venv/lib/python3.10/site-packages/croniter/croniter.py", line 190, in _alphaconv
return cls.ALPHACONV[index][key]
KeyError: '?'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-sync-engine/test_new_scheduler.py", line 74, in
it = croniter("0/3 * * * ? *", datetime(2021, 1, 1)-timedelta(days=1))
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-engine/venv/lib/python3.10/site-packages/croniter/croniter.py", line 183, in init
self.expanded, self.nth_weekday_of_month = self.expand(expr_format, hash_id=hash_id)
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-engine/venv/lib/python3.10/site-packages/croniter/croniter.py", line 807, in expand
return cls._expand(expr_format, hash_id=hash_id)
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-engine/venv/lib/python3.10/site-packages/croniter/croniter.py", line 749, in _expand
t = cls._alphaconv(i, t, expressions)
File "/home/ubuntu/Desktop/oneQuext/quext-scheduler-engine/venv/lib/python3.10/site-packages/croniter/croniter.py", line 192, in _alphaconv
raise CroniterNotAlphaError(
croniter.croniter.CroniterNotAlphaError: [0/3 * * * ? *] is not acceptable

@istrupin
Copy link

istrupin commented Jul 8, 2024

I'm running into this too -- is this based on a different cron spec perhaps? Would you be open to supporting the ? wildcard given a PR? The wikipedia article linked int he docs does show the ?.

@py-mu
Copy link

py-mu commented Dec 25, 2024

also,"0 0 * * * ? *" too, Whether there are other solutions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants