Python-crontab package returns __init__ error

cron, python

Solution

You've installed the crontab package, the documentation you showed is for python-crontab. They're two totally different packages.

Problem

Can anyone tell me what I'm doing wrong with python-crontab? ``` from crontab import CronTab system_cron = CronTab() ``` generates the following error: ``` File "test.py", line 3, in <module> cron = CronTab() TypeError: __init__() takes exactly 2 arguments (1 given) ``` I get the same problem when I try other variations of examples straight out of the package instructions: ``` my_user_cron = CronTab(user=True) users_cron = CronTab(user='username') ``` I've also tried creating the object with this approach, which I found in the python-crontab.py file: ``` cron = CronTab(tab='') ``` But it generates this error: `TypeError: __init__() got an unexpected keyword argument 'tab'` I've tried looking at the code in the package to see if maybe it's a documentation error and figure my way around, but it's beyond my skill level. I believe this is the code that defines how I should be creating a crontab object: ``` def __init__(self, user=None, tab=None, tabfile=None, log=None): if user == True and not WINOS: user = pwd.getpwuid( os.getuid() )[ 0 ] self.lines = None self.crons = None self.filen = None # Protect windows users self.root = not WINOS and os.getuid() == 0 self.user = user # Detect older unixes and help them out. self.intab = tab self.read(tabfile) self._log = log ``` Any thoughts on what I am doing wrong? help(CronTab) returns: ``` class CronTab(__builtin__.object) | Methods defined here: | | __init__(self, crontab) | | next(self, now=None, increments=[<function <lambda>>, <function <lambda>>, <function <lambda>>, <function _month_incr>, <function <lambda>>, <function _year_incr>, <function <lambda>>, <function <lambda>>, <function <lambda>>, <function <lambda>>, <function <lambda>>], delta=True) | How long to wait in seconds before this crontab entry can next be | executed. | | previous(self, now=None, delta=True) | | test(self, entry) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | matchers ```

Original source