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平台出什么问题都有的,不好搞

    评论

报告相同问题?

悬赏问题

  • ¥30 帮我写一段可以读取LD2450数据并计算距离的Arduino代码
  • ¥15 C#调用python代码(python带有库)
  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面