天天看点

Scrapy爬取新浪天气问题

最近学习爬虫框架Scrapy框架第一个实例-爬取新浪天气,然后就遇到报错:TypeError: 'float' object is not iterable

D:\scrapy\weather>scrapy crawl myweather -o wea.json

......

2017-03-15 12:25:45 [scrapy] ERROR: Error downloading <GET http://weather.sina.com.cn/robots.txt>: 'float' object is not iterable

Traceback (most recent call last):

......

TypeError: 'float' object is not iterable

2017-03-15 12:25:46 [scrapy] ERROR: Error downloading <GET http://weather.sina.com.cn>

TypeError: 'float' object is not iterable

......

在网上查阅发现是版本不匹配的问题,scrapy版本:1.1.1 twisted版本:17.1.0

twisted版本需要降低

在命令行输入conda install twisted=16.6.0

Scrapy爬取新浪天气问题

安装完成后执行scrapy crawl myweather -o wea.json即可