老师您好,我的scrapy-redis爬虫用scrapyd部署的时候出现了一个奇怪的错误,您能否帮我看看?
这个错误在pycharm中是不会出现的,更为奇怪的是,虽然Log中打印了这个错误,可是数据依然完好的爬取了下来,并写入了mysql数据库,
错误信息如下:
2017-07-26 16:52:57 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method FeedExporter.item_scraped of <scrapy.extensions.feedexport.FeedExporter object at 0x7f4eb1c38908>>
Traceback (most recent call last):
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
result = f(*args, **kw)
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/pydispatch/robustapply.py", line 55, in robustApply
return receiver(*arguments, **named)
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/scrapy/extensions/feedexport.py", line 224, in item_scraped
slot.exporter.export_item(item)
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/scrapy/exporters.py", line 92, in export_item
itemdict = dict(self._get_serialized_fields(item))
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/scrapy/exporters.py", line 66, in _get_serialized_fields
field_iter = six.iterkeys(item)
File "/home/song/.virtualenvs/scrapy_py3/lib/python3.5/site-packages/six.py", line 575, in iterkeys
return iter(d.keys(**kw))
AttributeError: 'NoneType' object has no attribute 'keys'
每爬取一条数据,都会报一下这个错,但数据确爬下来了,我google了一下,找到了一个类似的文章,但似乎不太好借鉴。
麻烦老师帮我看看,多谢。
带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎
了解课程