Traceback (most recent call last): File "D:\tuniutrips\venv\lib\site-packages\scrapy\utils\defer.py", line 117, in iter_errback yield next(it) File "D:\tuniutrips\venv\lib\site-packages\scrapy\utils\python.py", line 345, in __next__ return next(self.data) File "D:\tuniutrips\venv\lib\site-packages\scrapy\utils\python.py", line 345, in __next__ return next(self.data) File "D:\tuniutrips\venv\lib\site-packages\scrapy\core\spidermw.py", line 64, in _evaluate_iterable for r in iterable: File "D:\tuniutrips\venv\lib\site-packages\scrapy\spidermiddlewares\offsite.py", line 29, in process_spider_output for x in result: File "D:\tuniutrips\venv\lib\site-packages\scrapy\core\spidermw.py", line 64, in _evaluate_iterable for r in iterable: File "D:\tuniutrips\venv\lib\site-packages\scrapy\spidermiddlewares\referer.py", line 338, in <genexpr> return (_set_referer(r) for r in result or ()) File "D:\tuniutrips\venv\lib\site-packages\scrapy\core\spidermw.py", line 64, in _evaluate_iterable for r in iterable: File "D:\tuniutrips\venv\lib\site-packages\scrapy\spidermiddlewares\urllength.py", line 37, in <genexpr> return (r for r in result or () if _filter(r)) File "D:\tuniutrips\venv\lib\site-packages\scrapy\core\spidermw.py", line 64, in _evaluate_iterable for r in iterable: File "D:\tuniutrips\venv\lib\site-packages\scrapy\spidermiddlewares\depth.py", line 58, in <genexpr> return (r for r in result or () if _filter(r)) File "D:\tuniutrips\venv\lib\site-packages\scrapy\core\spidermw.py", line 64, in _evaluate_iterable for r in iterable: File "D:\tuniutrips\spiders\tuniu.py", line 22, in parse if k in item.fields: TypeError: argument of type 'NoneType' is not iterable怎么解决报错
时间: 2023-07-06 20:37:03 浏览: 193
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这个报错的原因是你在使用 Scrapy 爬虫时出现了 TypeError,具体来说是因为在你的代码中出现了一个 NoneType 类型的对象,而这个对象不支持迭代。要解决这个问题,需要检查代码中哪个部分可能会产生 NoneType 对象,并且将其改为正确的类型或者进行有效的异常处理。你可以在代码中添加一些断言语句或者调试语句来查找问题所在。另外,你也可以查看 Scrapy 的文档和源码,以了解更多关于 Scrapy 的使用和调试技巧。
阅读全文