Skip to content

Instantly share code, notes, and snippets.

@zourtney
Created March 4, 2014 05:30
Show Gist options
  • Save zourtney/9340796 to your computer and use it in GitHub Desktop.
Save zourtney/9340796 to your computer and use it in GitHub Desktop.
Python-crontab "invalid range specifier: 'root' ('root')"
Traceback (most recent call last):
File "./server.py", line 22, in <module>
scheduler = Scheduler(root_path=ROOT_PATH, switches=switches)
File "/home/pi/Development/lightcontrol/lightcontrol/scheduler.py", line 12, in __init__
self.refresh()
File "/home/pi/Development/lightcontrol/lightcontrol/scheduler.py", line 15, in refresh
self._crontab = CronTab('root')
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 275, in __init__
self.matchers = self._make_matchers(crontab)
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 283, in _make_matchers
for which, entry in enumerate(crontab.split())]
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 164, in __init__
al, en = self._parse_crontab(which, it)
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 263, in _parse_crontab
good.update(_parse_piece(it))
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 212, in _parse_piece
start = _fix(it)
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 201, in _fix
"invalid range specifier: %r (%r)", it, entry)
File "/usr/local/lib/python2.7/dist-packages/crontab/_crontab.py", line 150, in _assert
raise ValueError(message%args)
ValueError: invalid range specifier: 'root' ('root')
@purveshpatel511
Copy link

I had same issue and i have solve this issue.

I think there is a package error.

There are two packages crontab and python-crontab with same import command.

a crontab package is produce this error.

first check your installed packages list by running this command,
pip freeze
for python3
pip3 freeze

if there is crontab installed, remove package by running this command,
pip uninstall crontab
and install python-crontab package running this command,
pip install python-crontab

This is solve your error.
For more information on python-crontab, click here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment