scrapyd 部署在 KubeSphere 中,并且在运行 scrapy selenium 时出现异常:'twisted.internet.error.ReactorAlreadyInstalledError'

发布于 2025-01-15 05:40:48 字数 904 浏览 3 评论 0原文

我在 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

我没有单独安装twis​​ted。为什么它报告它已经存在?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一花一树开 2025-01-22 05:40:48

如果没有代码和包版本,很难猜测会发生什么。如果您的程序曾经运行过,请检查您的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文