我最近发布了一份要刮的工作稿。我在运行抓取工具时收到以下错误消息。
我查看了以下已解决的问题:https://github.com/scrapy/scrapy/issues/86并根据文档进行了建议的修复:http://scrapyd.readthedocs.org/en/latest/config.html
我的配置文件位于此处::/etc/scrapyd/conf.d/000-default
我似乎无法通过将items_dir设置为none来禁用Feedexporter扩展。有没有一种新的方法可以在scrapyd中禁用feedexporter?
配置文件:
[scrapyd]
http_port = 6800
debug = off
#max_proc = 1
eggs_dir = /var/lib/scrapyd/eggs
dbs_dir = /var/lib/scrapyd/dbs
items_dir =
logs_dir = /var/log/scrapyd
错误信息:
2014-10-12 06:29:15-0500 [jsc] ERROR: Error caught on signal handler: <bound method ?.item_scraped of <scrapy.contrib.feedexport.FeedExporter object at 0x7fc879ff82d0>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 577, in _runCallbacks
current.result = callback(current.result, *args, **kw)
File "/usr/lib/pymodules/python2.7/scrapy/core/scraper.py", line 215, in _itemproc_finished
item=output, response=response, spider=spider)
File "/usr/lib/pymodules/python2.7/scrapy/signalmanager.py", line 23, in send_catch_log_deferred
return signal.send_catch_log_deferred(*a, **kw)
File "/usr/lib/pymodules/python2.7/scrapy/utils/signal.py", line 53, in send_catch_log_deferred
*arguments, **named)
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 139, in maybeDeferred
result = f(*args, **kw)
File "/usr/lib/pymodules/python2.7/scrapy/xlib/pydispatch/robustapply.py", line 54, in robustApply
return receiver(*arguments, **named)
File "/usr/lib/pymodules/python2.7/scrapy/contrib/feedexport.py", line 190, in item_scraped
slot.exporter.export_item(item)
File "/usr/lib/pymodules/python2.7/scrapy/contrib/exporter/__init__.py", line 87, in export_item
itemdict = dict(self._get_serialized_fields(item))
File "/usr/lib/pymodules/python2.7/scrapy/contrib/exporter/__init__.py", line 71, in _get_serialized_fields
field = item.fields[field_name]
exceptions.AttributeError: 'dict' object has no attribute 'fields'
最佳答案
通过在settings.py中添加以下行,我可以在scrapyd中禁用FeedExporter
EXTENSIONS = {'scrapy.contrib.feedexport.FeedExporter': None}
禁用FeedExporter可以解决此问题。
关于python - Scrapyd错误:exceptions.AttributeError:'dict'对象没有属性'fields',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26327828/