开发者社区> 问答> 正文

scrapy 报错, 怎么查??报错

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'

展开
收起
爱吃鱼的程序员 2020-06-14 17:42:42 522 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    确定你得模块导入和路径设置都没问题?不确定啊,怎么弄?

    有可能是你自己建了一个文件名字叫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):

    2020-06-14 17:43:00
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载