ImportError: cannot import name ScrapyFileLogObserver
ImportError: cannot import name ScrapyFileLogObserver
我尝试用 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, there is no ScrapyFileLogObserver
anymore. Instead, Scrapy now uses twisted's PythonLoggingObserver
directly:
observer = twisted_log.PythonLoggingObserver('twisted')
observer.start()
我尝试用 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, there is no ScrapyFileLogObserver
anymore. Instead, Scrapy now uses twisted's PythonLoggingObserver
directly:
observer = twisted_log.PythonLoggingObserver('twisted')
observer.start()