关于在django框架中celery运行beat报OSError: [WinError 87] 参数错误的史诗级大坑

OSError: [WinError 87] 参数错误。

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "d:\anaconda\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\anaconda\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\Anaconda\Scripts\celery.exe\__main__.py", line 7, in 
  File "d:\anaconda\lib\site-packages\celery\__main__.py", line 30, in main
    main()
  File "d:\anaconda\lib\site-packages\celery\bin\celery.py", line 81, in main
    cmd.execute_from_commandline(argv)
  File "d:\anaconda\lib\site-packages\celery\bin\celery.py", line 770, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "d:\anaconda\lib\site-packages\celery\bin\base.py", line 311, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "d:\anaconda\lib\site-packages\celery\bin\celery.py", line 762, in handle_argv
    return self.execute(command, argv)
  File "d:\anaconda\lib\site-packages\celery\bin\celery.py", line 694, in execute
  File "d:\anaconda\lib\site-packages\celery\bin\base.py", line 315, in run_from_argv
    sys.argv if argv is None else argv, command)
  File "d:\anaconda\lib\site-packages\celery\bin\base.py", line 377, in handle_argv
    return self(*args, **options)
  File "d:\anaconda\lib\site-packages\celery\bin\base.py", line 274, in __call__
    ret = self.run(*args, **kwargs)
  File "d:\anaconda\lib\site-packages\celery\bin\beat.py", line 79, in run
    return beat().run()
  File "d:\anaconda\lib\site-packages\celery\apps\beat.py", line 83, in run
    self.start_scheduler()
  File "d:\anaconda\lib\site-packages\celery\apps\beat.py", line 95, in start_scheduler
    platforms.create_pidlock(self.pidfile)
  File "d:\anaconda\lib\site-packages\celery\platforms.py", line 255, in create_pidlock
    pidlock = _create_pidlock(pidfile)
  File "d:\anaconda\lib\site-packages\celery\platforms.py", line 262, in _create_pidlock
    if pidlock.is_locked() and not pidlock.remove_if_stale():
  File "d:\anaconda\lib\site-packages\celery\platforms.py", line 200, in remove_if_stale
    os.kill(pid, 0)
SystemError:  returned a result with an error set

运行beat的时候报这个错误,网上都说是版本问题,需要把版本从4.0+降为3.0+,可我的已经是3.1.19了还是有这个错误

我去源码里看了一下,意思好像是杀掉之前的进程失败导致的(os.kill(pid,****)这个代码出错了),我联想到之前beat停止之后再运行会说当前已有beat再运行,需要删除目录里的celerybeat.pid文件,我试了一下,把他删掉了

 

竟然跑通了(他喵的

你可能感兴趣的:(毕设日志)