Django celery beat pytz error on startup

纵然是瞬间 提交于 2019-12-11 13:52:37

问题


Out of the blue I get the following error when trying to start my dev server with celery and celery beat. One day this thing works next day it doesn't, I haven't changed anything that could explain this. I start my server using foreman and a Procfile.dev like so:

Procfile:

web: python manage.py runserver
celeryd: python manage.py celeryd -E -B --loglevel=INFO --concurrency=3
worker: python manage.py celerycam

Command:

foreman start -f Procfile.dev

Like I said this never gave any errors. Stacktrace is below:

14:18:44 celeryd.1  | [2013-03-01 14:18:44,216: INFO/Beat] Celerybeat: Starting...
14:18:44 celeryd.1  | [2013-03-01 14:18:44,224: WARNING/Beat] Process Beat:
14:18:44 celeryd.1  | [2013-03-01 14:18:44,224: WARNING/Beat] Traceback (most recent call last):
14:18:44 celeryd.1  | [2013-03-01 14:18:44,224: WARNING/MainProcess] celery@Allards-MacBook-Pro.local has started.
14:18:44 celeryd.1  | [2013-03-01 14:18:44,224: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/billiard/process.py", line 273, in _bootstrap
14:18:44 celeryd.1  | [2013-03-01 14:18:44,225: WARNING/Beat] self.run()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,226: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 472, in run
14:18:44 celeryd.1  | [2013-03-01 14:18:44,227: WARNING/Beat] self.service.start(embedded_process=True)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,227: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 401, in start
14:18:44 celeryd.1  | [2013-03-01 14:18:44,227: WARNING/Beat] humanize_seconds(self.scheduler.max_interval))
14:18:44 celeryd.1  | [2013-03-01 14:18:44,227: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/kombu/utils/__init__.py", line 234, in __get__
14:18:44 celeryd.1  | [2013-03-01 14:18:44,228: WARNING/Beat] value = obj.__dict__[self.__name__] = self.__get(obj)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,229: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 439, in scheduler
14:18:44 celeryd.1  | [2013-03-01 14:18:44,229: WARNING/Beat] return self.get_scheduler()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,229: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 434, in get_scheduler
14:18:44 celeryd.1  | [2013-03-01 14:18:44,229: WARNING/Beat] lazy=lazy)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,229: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/utils/imports.py", line 51, in instantiate
14:18:44 celeryd.1  | [2013-03-01 14:18:44,230: WARNING/Beat] return symbol_by_name(name)(*args, **kwargs)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,230: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 124, in __init__
14:18:44 celeryd.1  | [2013-03-01 14:18:44,231: WARNING/Beat] Scheduler.__init__(self, *args, **kwargs)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,231: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 158, in __init__
14:18:44 celeryd.1  | [2013-03-01 14:18:44,231: WARNING/Beat] self.setup_schedule()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,231: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 130, in setup_schedule
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] self.install_default_entries(self.schedule)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 216, in schedule
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] if self.schedule_changed():
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 161, in schedule_changed
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] self._last_timestamp = now()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,232: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/utils.py", line 65, in now
14:18:44 celeryd.1  | [2013-03-01 14:18:44,233: WARNING/Beat] return timezone.localtime(timezone.now())
14:18:44 celeryd.1  | [2013-03-01 14:18:44,233: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 222, in localtime
14:18:44 celeryd.1  | [2013-03-01 14:18:44,234: WARNING/Beat] timezone = get_current_timezone()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,234: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 130, in get_current_timezone
14:18:44 celeryd.1  | [2013-03-01 14:18:44,234: WARNING/Beat] return getattr(_active, "value", get_default_timezone())
14:18:44 celeryd.1  | [2013-03-01 14:18:44,234: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 112, in get_default_timezone
14:18:44 celeryd.1  | [2013-03-01 14:18:44,234: WARNING/Beat] _localtime = pytz.timezone(settings.TIME_ZONE)
14:18:44 celeryd.1  | [2013-03-01 14:18:44,235: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/pytz/__init__.py", line 183, in timezone
14:18:44 celeryd.1  | [2013-03-01 14:18:44,236: WARNING/Beat] fp.close()
14:18:44 celeryd.1  | [2013-03-01 14:18:44,236: WARNING/Beat] IOError: [Errno 9] Bad file descriptor

versions of my installed packages:

Django==1.4.1
celery==3.0.8
pytz==2012c

I have tried re-installing pytz, but that didn't help.

Any suggestions how to fix this?

EDIT 1

I have tried Burhan Khalid's answer and this did fix the IOError, however a new error is thrown. I have tried two places to paste the zoneinfo data and they resulted in different errors, which you can find below:

When pasted into usr/share/zoneinfo/ like suggested I get this:

14:20:07 worker.1   | Traceback (most recent call last):
14:20:07 worker.1   |   File "manage.py", line 9, in <module>
14:20:07 worker.1   |     execute_from_command_line(sys.argv)
14:20:07 celeryd.1  | Traceback (most recent call last):
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
14:20:07 celeryd.1  |   File "manage.py", line 9, in <module>
14:20:07 web.1      | Traceback (most recent call last):
14:20:07 worker.1   |     utility.execute()
14:20:07 celeryd.1  |     execute_from_command_line(sys.argv)
14:20:07 web.1      |   File "manage.py", line 9, in <module>
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
14:20:07 web.1      |     execute_from_command_line(sys.argv)
14:20:07 worker.1   |     self.fetch_command(subcommand).run_from_argv(self.argv)
14:20:07 celeryd.1  |     utility.execute()
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
14:20:07 web.1      |     utility.execute()
14:20:07 worker.1   |     app_name = get_commands()[subcommand]
14:20:07 celeryd.1  |     self.fetch_command(subcommand).run_from_argv(self.argv)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
14:20:07 web.1      |     self.fetch_command(subcommand).run_from_argv(self.argv)
14:20:07 worker.1   |     apps = settings.INSTALLED_APPS
14:20:07 celeryd.1  |     app_name = get_commands()[subcommand]
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 252, in fetch_command
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
14:20:07 web.1      |     app_name = get_commands()[subcommand]
14:20:07 worker.1   |     self._setup()
14:20:07 celeryd.1  |     apps = settings.INSTALLED_APPS
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/management/__init__.py", line 101, in get_commands
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 web.1      |     apps = settings.INSTALLED_APPS
14:20:07 worker.1   |     self._wrapped = Settings(settings_module)
14:20:07 celeryd.1  |     self._setup()
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 web.1      |     self._setup()
14:20:07 worker.1   |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 celeryd.1  |     self._wrapped = Settings(settings_module)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 web.1      |     self._wrapped = Settings(settings_module)
14:20:07 worker.1   |     __import__(name)
14:20:07 celeryd.1  |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 worker.1   |   File "/Users/allard/Projects/hellolily/lily/__init__.py", line 10, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 web.1      |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 worker.1   |     from django.forms.forms import BaseForm
14:20:07 celeryd.1  |     __import__(name)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/__init__.py", line 16, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/Projects/hellolily/lily/__init__.py", line 10, in <module>
14:20:07 web.1      |     __import__(name)
14:20:07 worker.1   |     from django.forms.fields import *
14:20:07 celeryd.1  |     from django.forms.forms import BaseForm
14:20:07 web.1      |   File "/Users/allard/Projects/hellolily/lily/__init__.py", line 10, in <module>
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/fields.py", line 18, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/__init__.py", line 16, in <module>
14:20:07 web.1      |     from django.forms.forms import BaseForm
14:20:07 worker.1   |     from django.core import validators
14:20:07 celeryd.1  |     from django.forms.fields import *
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/__init__.py", line 16, in <module>
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/validators.py", line 17, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/fields.py", line 18, in <module>
14:20:07 web.1      |     from django.forms.fields import *
14:20:07 worker.1   |     URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT
14:20:07 celeryd.1  |     from django.core import validators
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/forms/fields.py", line 18, in <module>
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/validators.py", line 17, in <module>
14:20:07 web.1      |     from django.core import validators
14:20:07 worker.1   |     self._setup()
14:20:07 celeryd.1  |     URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/core/validators.py", line 17, in <module>
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 web.1      |     URL_VALIDATOR_USER_AGENT = settings.URL_VALIDATOR_USER_AGENT
14:20:07 worker.1   |     self._wrapped = Settings(settings_module)
14:20:07 celeryd.1  |     self._setup()
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 web.1      |     self._setup()
14:20:07 worker.1   |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 celeryd.1  |     self._wrapped = Settings(settings_module)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 web.1      |     self._wrapped = Settings(settings_module)
14:20:07 worker.1   |     __import__(name)
14:20:07 celeryd.1  |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 93, in __init__
14:20:07 worker.1   |   File "/Users/allard/Projects/hellolily/lily/settings.py", line 53, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 web.1      |     mod = importlib.import_module(self.SETTINGS_MODULE)
14:20:07 worker.1   |     ('nl', gettext_noop('Dutch')),
14:20:07 celeryd.1  |     __import__(name)
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
14:20:07 celeryd.1  |   File "/Users/allard/Projects/hellolily/lily/settings.py", line 53, in <module>
14:20:07 web.1      |     __import__(name)
14:20:07 celeryd.1  |     ('nl', gettext_noop('Dutch')),
14:20:07 web.1      |   File "/Users/allard/Projects/hellolily/lily/settings.py", line 53, in <module>
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
14:20:07 web.1      |     ('nl', gettext_noop('Dutch')),
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
14:20:07 celeryd.1  |     return _trans.gettext_noop(message)
14:20:07 web.1      |     return _trans.gettext_noop(message)
14:20:07 worker.1   |     return _trans.gettext_noop(message)
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
14:20:07 celeryd.1  |     if settings.USE_I18N:
14:20:07 web.1      |     if settings.USE_I18N:
14:20:07 worker.1   |     if settings.USE_I18N:
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
14:20:07 celeryd.1  |     self._setup()
14:20:07 web.1      |     self._setup()
14:20:07 worker.1   |     self._setup()
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
14:20:07 celeryd.1  |     self._wrapped = Settings(settings_module)
14:20:07 web.1      |     self._wrapped = Settings(settings_module)
14:20:07 worker.1   |     self._wrapped = Settings(settings_module)
14:20:07 celeryd.1  |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 118, in __init__
14:20:07 web.1      |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 118, in __init__
14:20:07 worker.1   |   File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/conf/__init__.py", line 118, in __init__
14:20:07 celeryd.1  |     raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
14:20:07 web.1      |     raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
14:20:07 worker.1   |     raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
14:20:07 celeryd.1  | ValueError: Incorrect timezone setting: Europe/Amsterdam
14:20:07 web.1      | ValueError: Incorrect timezone setting: Europe/Amsterdam
14:20:07 worker.1   | ValueError: Incorrect timezone setting: Europe/Amsterdam
14:20:07 worker.1   | process terminated

When pasted into ~/.virtualenvs/env_name/lib/python2.7/site-packages/pytz/zoneinfo:

15:31:18 celeryd.1  | [2013-03-01 15:31:18,179: WARNING/Beat] Process Beat:
15:31:18 celeryd.1  | [2013-03-01 15:31:18,180: WARNING/Beat] Traceback (most recent call last):
15:31:18 celeryd.1  | [2013-03-01 15:31:18,180: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/billiard/process.py", line 273, in _bootstrap
15:31:18 celeryd.1  | [2013-03-01 15:31:18,180: WARNING/Beat] self.run()
15:31:18 celeryd.1  | [2013-03-01 15:31:18,181: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 472, in run
15:31:18 celeryd.1  | [2013-03-01 15:31:18,181: WARNING/Beat] self.service.start(embedded_process=True)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,181: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 401, in start
15:31:18 celeryd.1  | [2013-03-01 15:31:18,181: WARNING/Beat] humanize_seconds(self.scheduler.max_interval))
15:31:18 celeryd.1  | [2013-03-01 15:31:18,182: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/kombu/utils/__init__.py", line 234, in __get__
15:31:18 celeryd.1  | [2013-03-01 15:31:18,182: WARNING/Beat] value = obj.__dict__[self.__name__] = self.__get(obj)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,182: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 439, in scheduler
15:31:18 celeryd.1  | [2013-03-01 15:31:18,182: WARNING/Beat] return self.get_scheduler()
15:31:18 celeryd.1  | [2013-03-01 15:31:18,183: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 434, in get_scheduler
15:31:18 celeryd.1  | [2013-03-01 15:31:18,183: WARNING/Beat] lazy=lazy)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,183: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/utils/imports.py", line 51, in instantiate
15:31:18 celeryd.1  | [2013-03-01 15:31:18,183: WARNING/MainProcess] celery@Allards-MacBook-Pro.local has started.
15:31:18 celeryd.1  | [2013-03-01 15:31:18,183: WARNING/Beat] return symbol_by_name(name)(*args, **kwargs)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,184: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 124, in __init__
15:31:18 celeryd.1  | [2013-03-01 15:31:18,184: WARNING/Beat] Scheduler.__init__(self, *args, **kwargs)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,184: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/celery/beat.py", line 158, in __init__
15:31:18 celeryd.1  | [2013-03-01 15:31:18,184: WARNING/Beat] self.setup_schedule()
15:31:18 celeryd.1  | [2013-03-01 15:31:18,185: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 130, in setup_schedule
15:31:18 celeryd.1  | [2013-03-01 15:31:18,185: WARNING/Beat] self.install_default_entries(self.schedule)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,185: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 216, in schedule
15:31:18 celeryd.1  | [2013-03-01 15:31:18,185: WARNING/Beat] if self.schedule_changed():
15:31:18 celeryd.1  | [2013-03-01 15:31:18,185: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/schedulers.py", line 161, in schedule_changed
15:31:18 celeryd.1  | [2013-03-01 15:31:18,186: WARNING/Beat] self._last_timestamp = now()
15:31:18 celeryd.1  | [2013-03-01 15:31:18,186: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/djcelery/utils.py", line 65, in now
15:31:18 celeryd.1  | [2013-03-01 15:31:18,186: WARNING/Beat] return timezone.localtime(timezone.now())
15:31:18 celeryd.1  | [2013-03-01 15:31:18,186: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 222, in localtime
15:31:18 celeryd.1  | [2013-03-01 15:31:18,187: WARNING/Beat] timezone = get_current_timezone()
15:31:18 celeryd.1  | [2013-03-01 15:31:18,187: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 130, in get_current_timezone
15:31:18 celeryd.1  | [2013-03-01 15:31:18,187: WARNING/Beat] return getattr(_active, "value", get_default_timezone())
15:31:18 celeryd.1  | [2013-03-01 15:31:18,187: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/django/utils/timezone.py", line 112, in get_default_timezone
15:31:18 celeryd.1  | [2013-03-01 15:31:18,188: WARNING/Beat] _localtime = pytz.timezone(settings.TIME_ZONE)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,188: WARNING/Beat] File "/Users/allard/.virtualenvs/hellolily/lib/python2.7/site-packages/pytz/__init__.py", line 185, in timezone
15:31:18 celeryd.1  | [2013-03-01 15:31:18,188: WARNING/Beat] raise UnknownTimeZoneError(zone)
15:31:18 celeryd.1  | [2013-03-01 15:31:18,188: WARNING/Beat] UnknownTimeZoneError: 'Europe/Amsterdam'

So it seems the zoneinfo data provided is incorrect/incomplete. Where do I get the correct data?

EDIT 2:

I marked Burhan Khalid's answer as the answer even though for me it did not work. I did this because I am sure I did something wrong and the answer is correct. How I fixed this problem is simply by copy pasting the zoneinfo data from another macbook to this one.


回答1:


Seems your zoneinfo database is corrupted. Download the latest update and expand the archive into /usr/share/zoneinfo/.

To update your database, once you download the data you need to run zic (zone info compiler), and since you'll be updating the system zone files, you need to run it with sudo:

tar xvzf tzdata2012j.tar.gz

Then create this small script:

#!/bin/bash

ZONES="africa
antartica
asia
australasia
europe
northamerica
pacificnew
solar87
solar88
solar89
southamerica"

for i in $ZONES
   do zic $i
done

Then run it with sudo ./the_script.sh from the directory where you expanded the archive.



来源:https://stackoverflow.com/questions/15159029/django-celery-beat-pytz-error-on-startup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!