Brain_csdn 2018-06-13 07:40 采纳率: 0%
浏览 1051
已结题

celery+redis启动报错attribute 'hash_randomization'

遇到一个问题,在使用"celery -A Redis worker --loglevel=info"命令启动时,报错
AttributeError: 'sys.flags' object has no attribute 'hash_randomization'
没找到具体是哪里的问题

我用的代码

 # coding: utf-8
from celery import Celery

broker = 'redis://localhost:6379'
backend = 'redis://localhost:6379'

# "Redis" 任务名 (与当前文件名一致)
app = Celery("Redis", broker=broker, backend=backend)


@app.task()
def redis_main(x):
    print "Hello %s!" % x

具体的报错

  -------------- celery@DESKTOP-DK5Q8NF v4.2.0 (windowlicker)
---- **** -----
--- * ***  * -- Windows-post2008Server-6.2.9200 2018-06-13 15:29:30
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app:         Redis:0x5a88198
- ** ---------- .> transport:   redis://localhost:6379//
- ** ---------- .> results:     redis://localhost:6379/
- *** --- * --- .> concurrency: 4 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery


[tasks]
  . Redis.redis_main

[2018-06-13 15:29:31,095: CRITICAL/MainProcess] Unrecoverable error: AttributeError("'sys.flags' object has no attribute 'hash_randomization'",)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\celery-4.2.0-py2.7.egg\celery\worker\worker.py", line 205, in start
    self.blueprint.start(self)
  File "C:\Python27\lib\site-packages\celery-4.2.0-py2.7.egg\celery\bootsteps.py", line 119, in start
    step.start(parent)
  File "C:\Python27\lib\site-packages\celery-4.2.0-py2.7.egg\celery\bootsteps.py", line 369, in start
    return self.obj.start()
  File "C:\Python27\lib\site-packages\celery-4.2.0-py2.7.egg\celery\concurrency\base.py", line 131, in start
    self.on_start()
  File "C:\Python27\lib\site-packages\celery-4.2.0-py2.7.egg\celery\concurrency\prefork.py", line 112, in on_start
    **self.options)
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\pool.py", line 1007, in __init__
    self._create_worker_process(i)
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\pool.py", line 1116, in _create_worker_process
    w.start()
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\process.py", line 124, in start
    self._popen = self._Popen(self)
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\context.py", line 383, in _Popen
    return Popen(process_obj)
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\popen_spawn_win32.py", line 55, in __init__
    pipe_handle=rhandle)
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\spawn.py", line 147, in get_command_line
    opts = util._args_from_interpreter_flags()
  File "C:\Python27\lib\site-packages\billiard-3.5.0.3-py2.7-win-amd64.egg\billiard\util.py", line 36, in _args_from_interpreter_flags
    v = getattr(sys.flags, flag)
AttributeError: 'sys.flags' object has no attribute 'hash_randomization'
  • 写回答

3条回答

  • J.zhang11 2018-06-13 09:37
    关注

    sys.flags 中应该是有 hash_randomization的,如果没有说明本目录中有其它模块覆盖了此模块 。不过windows平台出什么问题都有的,不好搞

    评论

报告相同问题?

悬赏问题

  • ¥15 求帮我调试一下freefem代码
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图