因此,我有这个selenium和烧瓶应用程序,我部署在数字海洋的ubuntu上。当我以"main@ubutu$python3 3 pyfile.py“的开发模式运行应用程序时,一切都运行得很完美,没有抛出任何错误。但是,当我在生产模式上运行应用程序时,即当应用程序被部署时,我会得到以下错误。
The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed我有最新的谷歌-铬和色度驱动器。
main@ubuntu:~$ google-chrome --version
Google Chrome 102.0.5005.61在我的代码中,我还包括了在没有显示的VPS上运行所需的所有选项。
option = Options()
service = Service("/home/path/to/chromedriver")
#option.binary_location = "/usr/bin/google-chrome-stable"
option.add_argument("--headless")
option.add_argument("--no-sandbox")
option.add_argument("--disable-extensions")
option.add_argument("--disable-setuid-sandbox")
option.add_argument("--remote-debugging-port=9222")
option.add_argument("--disable-gpu")
option.add_argument("--start-maximized")
option.add_argument("--disable-dev-shm-usage")
driver = webdriver.Chrome(service=service, options=option)许多人都经历过这个问题,但是选择--没有沙箱和无头--似乎已经解决了他们的问题。但即使在那之后,我仍然有同样的问题。谷歌-铬路径/urs/bin/谷歌-铬。如有任何帮助,将不胜感激。
发布于 2022-06-04 22:31:03
我使用的是数字海洋的ubuntu,所以我跟踪了他们关于如何在服务器上部署烧瓶应用程序的文档。如果您正在跟踪他们的文档,那么您就会遇到这样的情况。这是解决办法。thanks to @Lewis Morris
问题是我在/etc/systemd/system/myapp.service中使用的路径ENVIRONMENT_PATH,最初它是
Environment="PATH=/home/main/searchapp/venv/bin然后我把它改成:
Environment="PATH=/home/main/searchapp/venv/bin:/usr/bin:/bin"希望这对将来的人有帮助,这样他们就不用浪费时间了。
https://stackoverflow.com/questions/72487136
复制相似问题