tags:

views:

15

answers:

1

When trying to run django-celery with beat scheduler:

bin/django celeryd -B --settings=app.development --loglevel=INFO

I got this exception:

Process Beat:
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/multiprocessing/process.py", line 237, in _bootstrap
self.run()
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 388, in run
self.service.start(embedded_process=True)
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 318, in start
humanize_seconds(self.scheduler.max_interval)))
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 358, in scheduler
self._scheduler = self.get_scheduler()
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 350, in get_scheduler
lazy=lazy)
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/utils/__init__.py", line 362, in instantiate
return get_cls_by_name(name)(*args, **kwargs)
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 270, in __init__
Scheduler.__init__(self, *args, **kwargs)
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 146, in __init__
self.setup_schedule()
File "/home/user/eggs/celery-2.1.1-py2.6.egg/celery/beat.py", line 273, in setup_schedule
self._store = self.persistence.open(self.schedule_filename)
File "/usr/lib/python2.6/shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/lib/python2.6/shelve.py", line 223, in __init__
Shelf.__init__(self, anydbm.open(filename, flag), protocol, writeback)
AttributeError: 'module' object has no attribute 'open'

My own investigation led me to discovering that the anydbm python module found in

/usr/lib/python2.6/anydbm.py

is an empty file. But the python2.6.5 doc says there is an

anydbm.open(filename[, flag[, mode]])

method.

Am I missing something? I think the anydbm [ubuntu] python module is broken.

I'm using:

  • Ubuntu 10.04

  • Python 2.6.5

  • django-celery 2.1.1

  • celery installed with buildout

A: 

If /usr/lib/python2.6/anydbm.py is an empty file for you, then yes, your installation is broken. /usr/lib/python2.6/anydbm.py is the correct file, with contents, on my Ubuntu 10.04 system, with python2.6_2.6.5-1ubuntu6 installed. You'll want to make sure you have the latest package installed, and possibly reinstall it.

Thomas Wouters
Reinstalling python2.6 fixed this error. I used this command: apt-get install --reinstall python2.6But it is still a mystery how could this happen.
univ
Something overwrote the file. Filesystem corruption, careless root processes, disk full during an update, who knows.
Thomas Wouters