芹菜扔长错误信息

时间:2017-01-21 03:09:30

标签: python celery

我试图在他们的网站(http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html)上运行celery的入门代码,并且我在后台运行RabbitMQ服务器的实例。但是,我收到了很长的错误消息:

>>> from celery import Celery
>>> app = Celery('tasks', broker='pyamqp://guest@localhost//')
>>> @app.task
... def add(x, y):
...     return x + y
...
>>>
>>> add.delay(4, 4)
Traceback (most recent call last):
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 36, in __call__
    return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 494, in _ensured
    return fun(*args, **kwargs)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 187, in _publish
    channel = self.channel
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 209, in _get_channel
    channel = self._channel = channel()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 38, in __call__
    value = self.__value__ = self.__contract__()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 224, in <lambda>
    channel = ChannelPromise(lambda: connection.default_channel)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 819, in default_channel
    self.connection
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
    conn.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
    self.transport.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
    self.socket_settings, self.read_timeout, self.write_timeout,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
    self._set_socket_options(socket_settings)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
    self.sock.setsockopt(SOL_TCP, opt, val)
OSError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
    yield
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 515, in _ensured
    reraise_as_library_errors=False,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 405, in ensure_connection
    callback)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 333, in retry_over_time
    return fun(*args, **kwargs)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 261, in connect
    return self.connection
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
    conn.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
    self.transport.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
    self.socket_settings, self.read_timeout, self.write_timeout,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
    self._set_socket_options(socket_settings)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
    self.sock.setsockopt(SOL_TCP, opt, val)
OSError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\task.py", line 412, in delay
    return self.apply_async(args, kwargs)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\task.py", line 535, in apply_async
    **options
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\base.py", line 737, in send_task
    amqp.send_task_message(P, name, message, **options)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\amqp.py", line 558, in send_task_message
    **properties
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 181, in publish
    exchange_name, declare,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 527, in _ensured
    errback and errback(exc, 0)
  File "C:\Users\Alexander\Anaconda3\lib\contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 419, in _reraise_as_library_errors
    sys.exc_info()[2])
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\vine\five.py", line 175, in reraise
    raise value.with_traceback(tb)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
    yield
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 515, in _ensured
    reraise_as_library_errors=False,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 405, in ensure_connection
    callback)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 333, in retry_over_time
    return fun(*args, **kwargs)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 261, in connect
    return self.connection
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
    self._connection = self._establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
    conn = self.transport.establish_connection()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
    conn.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
    self.transport.connect()
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
    self.socket_settings, self.read_timeout, self.write_timeout,
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
    self._set_socket_options(socket_settings)
  File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
    self.sock.setsockopt(SOL_TCP, opt, val)
kombu.exceptions.OperationalError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call

1 个答案:

答案 0 :(得分:10)

在github上存在一个未解决的问题:

https://github.com/celery/py-amqp/issues/130

有人在评论中建议通过将amqp的版本降级为2.1.3暂时解决

要降级的步骤:

  1. 使用$ pip uninstall amqp卸载amqp。
  2. 使用$ pip install -Iv amqp==2.1.3安装amqp。