scrapyd 部署在 KubeSphere 中,并且在运行 scrapy selenium 时出现异常:'twisted.internet.error.ReactorAlreadyInstalledError'
我在 KubeSphere 中部署了 scrapyd,当我运行 scrapy 和 selenium 时,我得到了期望:
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] return Crawler(spidercls, self.settings, init_reactor=True)
File "/usr/local/lib/python3.9/site-packages/scrapy/crawler.py", line 82, in __init__
default.install()
File "/usr/local/lib/python3.9/site-packages/twisted/internet/epollreactor.py", line 256, in install
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] installReactor(p)
File "/usr/local/lib/python3.9/site-packages/twisted/internet/main.py", line 32, in installReactor
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] raise error.ReactorAlreadyInstalledError("reactor already installed")
twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed
我没有单独安装twisted。为什么它报告它已经存在?
I deploy scrapyd
in KubeSphere, I got expectation when I run scrapy
and selenium
:
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] return Crawler(spidercls, self.settings, init_reactor=True)
File "/usr/local/lib/python3.9/site-packages/scrapy/crawler.py", line 82, in __init__
default.install()
File "/usr/local/lib/python3.9/site-packages/twisted/internet/epollreactor.py", line 256, in install
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] installReactor(p)
File "/usr/local/lib/python3.9/site-packages/twisted/internet/main.py", line 32, in installReactor
2022-03-16T12:57:15+0000 [Launcher,1832/stderr] raise error.ReactorAlreadyInstalledError("reactor already installed")
twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed
I don't have twisted installed separately. Why does it report that it already exists?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果没有代码和包版本,很难猜测会发生什么。如果您的程序曾经运行过,请检查您的 scrapy 版本。最新的 2.6 版本中有一个问题。您可以将 scrapy 固定在 2.5.1 。
如果您正在开发 scrapy 脚本,您可能希望在一个脚本中运行多个爬虫。很容易搞乱管道并出现
twisted.internet.error.ReactorAlreadyInstalledError
错误。您可以检查这个。Without code and package version, it is hard to guess what happens. If your program was once working, check your scrapy version. There is an issue in latest 2.6 version. You could pin your scrapy at 2.5.1 .
If you are under developing scrapy scripts, you might want to run multiple spiders in a script. It is easy to mess up the pipeline and get
twisted.internet.error.ReactorAlreadyInstalledError
error. You could check this.