scrapy 报错, 怎么查?

帖子列表 发布于 2015/03/01 19:43
阅读 1K+
收藏 0
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'
加载中
0
小心有诈
小心有诈
确定你得模块导入和路径设置都没问题?
帖子列表
帖子列表
不确定啊, 怎么弄?
0
太乙
太乙

有可能是你自己建了一个文件名字叫scrapy,删了换个名字看看:)

帖子列表
帖子列表
不是我建的,是sudo apt-get install 装的
0
atwal
atwal

import scrapy

换为

from scrapy.spider import Spider

然后,把这里:

class RobotSpider(scrapy.Spider):

改为:

class RobotSpider(Spider):
返回顶部
顶部