Scrapyd错误 - AttributeError:'NoneType'对象没有属性'module_name'

时间:2015-08-24 14:40:46

标签: python scrapy scrapyd

这是通过运行setup.py

生成的scrapyd-deploy

我的项目名为crawler,存在于crawler目录

# Automatically created by: scrapyd-deploy

from setuptools import setup, find_packages

setup(
    name         = 'project',
    version      = '1.0',
    packages     = find_packages(),
    entry_points = {'crawler': ['settings = crawler.settings']},
)

cd进入crawler并运行scrapyd-deploy

时,我收到此错误
Packing version 1440426986
Deploying to project "crawler" in http://localhost:6800/addversion.json
Server response (200):
{"status": "error", "message": "AttributeError: 'NoneType' object has no attribute 'module_name'", "node_name": "mybox"}

这是scrapyd的堆栈跟踪

2015-08-24 20:06:26+0530 [HTTPChannel,28,127.0.0.1] Unhandled Error
    Traceback (most recent call last):
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/twisted/web/http.py", line 1755, in allContentReceived
        req.requestReceived(command, path, version)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/twisted/web/http.py", line 823, in requestReceived
        self.process()
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/twisted/web/server.py", line 189, in process
        self.render(resrc)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/twisted/web/server.py", line 238, in render
        body = resrc.render(self)
    --- <exception caught here> ---
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/scrapyd/webservice.py", line 17, in render
        return JsonResource.render(self, txrequest)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/scrapyd/utils.py", line 19, in render
        r = resource.Resource.render(self, txrequest)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/twisted/web/resource.py", line 250, in render
        return m(request)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/scrapyd/webservice.py", line 68, in render_POST
        spiders = get_spider_list(project)
      File "/home/tejesh/projects/billionleads/python/python2.7-env/local/lib/python2.7/site-packages/scrapyd/utils.py", line 114, in get_spider_list
        raise RuntimeError(msg.splitlines()[-1])
    exceptions.RuntimeError: AttributeError: 'NoneType' object has no attribute 'module_name'

这里出了什么问题?

1 个答案:

答案 0 :(得分:0)

entry_points中的值更改为'scrapy'而不是'crawler'

setup(
    name         = 'project',
    version      = '1.0',
    packages     = find_packages(),
    entry_points = {'scrapy': ['settings = crawler.settings']},
)