python-2.7 - AttributeError: 'module' 对象没有属性 'update_settings' scrapy 1.0.5

标签 python-2.7 scrapy scrapy-spider attributeerror

爬虫通过命令行工作正常,给出了这个错误:

2016-03-30 03:47:59 [scrapy] INFO: Scrapy 1.0.5 started (bot: scrapybot)
2016-03-30 03:47:59 [scrapy] INFO: Optional features available: ssl, http11
2016-03-30 03:47:59 [scrapy] INFO: Overridden settings: {'USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'}

Traceback (most recent call last):
  File "/home/ahmeds/scrapProject/crawler/startcrawls.py", line 11, in <module>
    process.crawl(onioncrawl)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 150, in crawl
    crawler = self._create_crawler(crawler_or_spidercls)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 166, in _create_crawler
    return Crawler(spidercls, self.settings)
  File "/usr/local/lib/python2.7/dist-packages/scrapy/crawler.py", line 32, in __init__
    self.spidercls.update_settings(self.settings)
AttributeError: 'module' object has no attribute 'update_settings'

这是我按照 latest documentation 通过脚本运行我的爬虫的代码.我的scrapy版本是1.0.5。
from scrapy.crawler import CrawlerProcess
from scrapy.utils.project import get_project_settings
from crawler.spiders import onioncrawl

setting = get_project_settings()
process = CrawlerProcess(setting)
process.crawl(onioncrawl)
process.start()

最佳答案

我使用的是 Spider 文件名而不是 Spider 类名。

关于python-2.7 - AttributeError: 'module' 对象没有属性 'update_settings' scrapy 1.0.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36296786/

相关文章:

python - Scrapy:在每条记录中重复 Response.URL

web-hosting - 在后端运行 Scrapy Spider 的 Web 托管网站的最佳实践

python - 安装 Scrapy 的问题

python - img src=blob : how to download image?

python - 无法部署到 GAE

python-2.7 - 请求中缺少表单数据

excel - "com_error: (-2147417851, ' 服务器抛出异常。 ', None, None)"

python - 强制 Python Scrapy 不对 URL 进行编码

python-3.x - Scrapy - 类型错误 : 'Rule' object is not iterable

excel - 将工作表添加到现有 Excel 工作表而不删除其他工作表