[go: up one dir, main page]

Multiple global env vars cause error loading crontab

Created by: nnashok

The following crontab cant be loaded:

ALL='all'
ABCD='first'
* * * * * echo "first"

with error:

In [95]: cron = CronTab(tabfile="mixed.tab")
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-95-90f9e51060e3> in <module>()
----> 1 cron = CronTab(tabfile="mixed.tab")

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/crontab.py in __init__(self, user, tab, tabfile, log)
    214         # Load string or filename as inital crontab
    215         self.intab = tab
--> 216         self.read(tabfile)
    217         self._log = log
    218 

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/crontab.py in read(self, filename)
    269 
    270         for line in lines:
--> 271             self.append(CronItem(line, cron=self), line, read=True)
    272 
    273     def append(self, item, line='', read=False):

/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/crontab.py in append(self, item, line, read)
    274         """Append a CronItem object to this CronTab"""
    275         if item.is_valid():
--> 276             for key in self._parked_env:
    277                 item.env[key] = self._parked_env.pop(key)
    278 

RuntimeError: OrderedDict mutated during iteration

If I remove the job line, the crontab loads fine.