我是新来的芹菜,我正在关注他们网站上给出的教程,我得到了这个错误
from celery import Celery
app = Celery('tasks', broker='pyamqp://guest@localhost//')
@app.task
def add(x, y):
return x + y
和cmd显示这样的错误
-------------- celery@DESKTOP-O90R45G v4.0.2 (latentcall)
---- **** -----
--- * *** * -- Windows-10-10.0.14393 2016-12-16 20:05:48
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: tasks:0x4591950
- ** ---------- .> transport: amqp://guest:**@localhost:5672//
- ** ---------- .> results: disabled://
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- -------------- [queues]
.> celery exchange=celery(direct) key=celery
[tasks] . tasks.add
[2016-12-16 20:05:49,029: CRITICAL/MainProcess] Unrecoverable error:
TypeError('argument 1 must be an integer, not _subprocess_handle',)
Traceback (most recent call last): File
"c:python27libsite-packagesceleryworkerworker.py", line 203, in
start
self.blueprint.start(self) File "c:python27libsite-packagescelerybootsteps.py", line 119, in
start
step.start(parent) File "c:python27libsite-packagescelerybootsteps.py", line 370, in
start
return self.obj.start() File "c:python27libsite-packagesceleryconcurrencybase.py", line 131,
in start
self.on_start() File "c:python27libsite-packagesceleryconcurrencyprefork.py", line
112, in on_start
**self.options) File "c:python27libsite-packagesbilliardpool.py", line 1008, in
__init__
self._create_worker_process(i) File "c:python27libsite-packagesbilliardpool.py", line 1117, in
_create_worker_process
w.start() File "c:python27libsite-packagesbilliardprocess.py", line 122, in
start
self._popen = self._Popen(self) File "c:python27libsite-packagesbilliardcontext.py", line 383, in
_Popen
return Popen(process_obj) File "c:python27libsite-packagesbilliardpopen_spawn_win32.py", line
64, in __init__
_winapi.CloseHandle(ht) TypeError: argument 1 must be an integer, not _subprocess_handle Traceback (most recent call last): File
"<string>", line 1, in <module> File
"c:python27libsite-packagesbilliardspawn.py", line 159, in
spawn_main
new_handle = steal_handle(parent_pid, pipe_handle) File "c:python27libsite-packagesbilliardreduction.py", line 126, in
steal_handle
_winapi.DUPLICATE_SAME_ACCESS | _winapi.DUPLICATE_CLOSE_SOURCE) >WindowsError: [Error 6] The handle is invalid
芹菜在Windows中不再支持4.0以来,如他们的读书中所述:
芹菜是一个具有最低资金的项目,因此我们不支持Microsoft Windows。请不要打开与该平台有关的任何问题。
不幸的是,此错误似乎是副作用之一(支持被删除的过程手柄)
您最好的选择是降级芹菜,然后先删除: pip install celery==3.1.18
看起来您的RabbitMQ服务器未运行。您是否运行安装并启动Rabbimq服务器?
您可以查看RabbitMQ文档并安装它。启动RabbitMQ服务器,然后使用您的应用程序
启动您的芹菜工人celery worker -l info -A tasks