2015-02-27 15:50:57+0800 [scrapy] INFO: Scrapy 0.12.0.2546 started (bot: robot)
2015-02-27 15:50:58+0800 [scrapy] DEBUG: Enabled extensions: TelnetConsole, SpiderContext, WebService, CoreStats, MemoryUsage, CloseSpider
Traceback (most recent call last):
File "/usr/bin/scrapy", line 4, in
execute()
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 131, in execute
run_print_help(parser, run_command, cmd, args, opts)
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 97, in _run_print_help
func(a, *kw)
File "/usr/lib/python2.7/dist-packages/scrapy/cmdline.py", line 138, in _run_command
cmd.run(args, opts)
File "/usr/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 42, in run
q = self.crawler.queue
File "/usr/lib/python2.7/dist-packages/scrapy/command.py", line 33, in crawler
self._crawler.configure()
File "/usr/lib/python2.7/dist-packages/scrapy/crawler.py", line 36, in configure
self.spiders = spman_cls.from_settings(self.settings)
File "/usr/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 33, in from_settings
return cls(settings.getlist('SPIDER_MODULES'))
File "/usr/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 23, in __init
for module in walk_modules(name):
File "/usr/lib/python2.7/dist-packages/scrapy/utils/misc.py", line 65, in walk_modules
submod = import(fullpath, {}, {}, [''])
File "/root/mine/ZHIHU-Robot/robot/robot/spiders/RobotSpider.py", line 13, in
class RobotSpider(scrapy.Spider):
AttributeError: 'module' object has no attribute 'Spider'
确定你得模块导入和路径设置都没问题?不确定啊,怎么弄?
有可能是你自己建了一个文件名字叫scrapy,删了换个名字看看:)
不是我建的,是sudoapt-getinstall装的把
<preclass="brush:python;toolbar:true;auto-links:false;">importscrapy<spanstyle="line-height:1.5;font-size:10pt;">换为
<preclass="brush:python;toolbar:true;auto-links:false;">fromscrapy.spiderimportSpider然后,把这里:
<preclass="brush:python;toolbar:true;auto-links:false;">classRobotSpider(scrapy.Spider):<spanstyle="line-height:1.5;font-size:10pt;">改为:
<preclass="brush:python;toolbar:true;auto-links:false;">classRobotSpider(Spider):版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。