美文网首页
celery 报错 RuntimeError: 'path' m

celery 报错 RuntimeError: 'path' m

作者: Jayce_xi | 来源:发表于2019-07-24 11:33 被阅读0次

1. 问题描述

在merge完代码后,发现服务起不来了。错误报的是:

RuntimeError: 'path' must be None or a list, not <class '_frozen_importlib_external._NamespacePath'>

2.问题分析

完全没遇到过发,直接google,发现第一个的答案完全不太一样,在第二个中发现一个好的回答:

This error will occur when use autodiscover_task in celery and one of these app's folder did't have init.py file
pretty hard to find out what is going on.. debug information is lack

原因就是celery中autodiscover_task会去扫描每一个注册的app底下的__init__.py文件,恰好,merge的代码里面有一个app没有这个文件。这中情况是极少发生的。

3. 问题解决

在没有__init__.py的app中添加__init__.py

4.参考解答

github/celery/issues/2523

相关文章

网友评论

      本文标题:celery 报错 RuntimeError: 'path' m

      本文链接:https://www.haomeiwen.com/subject/lsatrctx.html