我尝试使用 ScrapyFileLogObserver 测试 scrapy 日志。在我的源代码中,我正确地设置了要使用的包:
from scrapy.log import ScrapyFileLogObserver
但是当我启动我的蜘蛛时出现了这个错误:
from scrapy.log import ScrapyFileLogObserver
ImportError: cannot import name ScrapyFileLogObserver
有关信息,我使用最新版本的 scrapy (Scrapy 1.0.1)。 我该如何修复我的错误?
最佳答案
在1.0 Scrapy的日志系统中was completely rewritten , 不再有 ScrapyFileLogObserver
了。相反,Scrapy 现在 uses twisted's PythonLoggingObserver
directly :
observer = twisted_log.PythonLoggingObserver('twisted')
observer.start()
关于python - 导入错误 : cannot import name ScrapyFileLogObserver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31837917/