慕仙156297
2019-07-12 13:10
2019-07-12 13:08:41 [scrapy.utils.log] INFO: Scrapy 1.6.0 started (bot: douban)
2019-07-12 13:08:41 [scrapy.utils.log] INFO: Versions: lxml 4.3.2.0, libxml2 2.9.9, cssselect 1.0.3, parsel 1.5.1, w3lib 1.20.0, Twisted 19.2.0, Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)], pyOpenSSL 19.0.0 (OpenSSL 1.1.1b 26 Feb 2019), cryptography 2.6.1, Platform Windows-7-6.1.7601-SP1
2019-07-12 13:08:41 [scrapy.crawler] INFO: Overridden settings: {'BOT_NAME': 'douban', 'NEWSPIDER_MODULE': 'douban.spiders', 'SPIDER_MODULES': ['douban.spiders']}
2019-07-12 13:08:41 [scrapy.extensions.telnet] INFO: Telnet Password: 44987eba4e402262
2019-07-12 13:08:41 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
'scrapy.extensions.telnet.TelnetConsole',
'scrapy.extensions.logstats.LogStats']
2019-07-12 13:08:43 [scrapy.middleware] INFO: Enabled downloader middlewares:
['scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware',
'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware',
'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware',
'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware',
'scrapy.downloadermiddlewares.retry.RetryMiddleware',
'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware',
'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware',
'scrapy.downloadermiddlewares.redirect.RedirectMiddleware',
'scrapy.downloadermiddlewares.cookies.CookiesMiddleware',
'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware',
'scrapy.downloadermiddlewares.stats.DownloaderStats']
2019-07-12 13:08:43 [scrapy.middleware] INFO: Enabled spider middlewares:
['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware',
'scrapy.spidermiddlewares.offsite.OffsiteMiddleware',
'scrapy.spidermiddlewares.referer.RefererMiddleware',
'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware',
'scrapy.spidermiddlewares.depth.DepthMiddleware']
2019-07-12 13:08:43 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2019-07-12 13:08:43 [scrapy.core.engine] INFO: Spider opened
2019-07-12 13:08:43 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2019-07-12 13:08:43 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
2019-07-12 13:08:43 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://movie.douban.com/top250> (referer: https://www.douban.com/)
2019-07-12 13:08:43 [scrapy.core.scraper] ERROR: Spider error processing <GET https://movie.douban.com/top250> (referer: https://www.douban.com/)
Traceback (most recent call last):
File "D:\Computer program\Anaconda3\lib\site-packages\scrapy\utils\defer.py", line 102, in iter_errback
yield next(it)
File "D:\Computer program\Anaconda3\lib\site-packages\scrapy\spidermiddlewares\offsite.py", line 29, in process_spider_output
for x in result:
File "D:\Computer program\Anaconda3\lib\site-packages\scrapy\spidermiddlewares\referer.py", line 339, in <genexpr>
return (_set_referer(r) for r in result or ())
File "D:\Computer program\Anaconda3\lib\site-packages\scrapy\spidermiddlewares\urllength.py", line 37, in <genexpr>
return (r for r in result or () if _filter(r))
File "D:\Computer program\Anaconda3\lib\site-packages\scrapy\spidermiddlewares\depth.py", line 58, in <genexpr>
return (r for r in result or () if _filter(r))
File "E:\pycharm\douban\douban\spiders\douban_spider.py", line 23, in parse
for i_content in content:
TypeError: 'method' object is not iterable
2019-07-12 13:08:43 [scrapy.core.engine] INFO: Closing spider (finished)
2019-07-12 13:08:43 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 391,
'downloader/request_count': 1,
'downloader/request_method_count/GET': 1,
'downloader/response_bytes': 12904,
'downloader/response_count': 1,
'downloader/response_status_count/200': 1,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2019, 7, 12, 5, 8, 43, 874878),
'log_count/DEBUG': 1,
'log_count/ERROR': 1,
'log_count/INFO': 9,
'response_received_count': 1,
'scheduler/dequeued': 1,
'scheduler/dequeued/memory': 1,
'scheduler/enqueued': 1,
'scheduler/enqueued/memory': 1,
'spider_exceptions/TypeError': 1,
'start_time': datetime.datetime(2019, 7, 12, 5, 8, 43, 143836)}
2019-07-12 13:08:43 [scrapy.core.engine] INFO: Spider closed (finished)
报错在“TypeError: 'method' object is not iterable”,在此前的运行是爬虫的正常启动信息。通过报错可知,代码中content的类型错误。不知道你的代码,所以我就举个改错的的例子:
在用webdriver时,若用
content = driver.find_element_by_xpath()
会出现和你相似的错误,要改为:
content = driver.find_elements_by_xpath()
你好 请问你解决了吗 我刚开始学scrapy 也遇到了这个问题?
你好 请问你解决了吗 我刚开始学scrapy 也遇到了这个问题?
Python最火爬虫框架Scrapy入门与实践
67418 学习 · 223 问题
相似问题