Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error DevToolsActivePort file doesn't exist #47

Open
gitxinyi opened this issue Aug 17, 2021 · 2 comments
Open

Error DevToolsActivePort file doesn't exist #47

gitxinyi opened this issue Aug 17, 2021 · 2 comments

Comments

@gitxinyi
Copy link

gitxinyi commented Aug 17, 2021

在代码部署调试的时候,一直报这个错误,

raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

查了一些资料,需要添加几个参数
“–no-sandbox”参数是让Chrome在root权限下跑

修改文件项目文件 crawler.py 330行左右,添加参数解决问题
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--headless')
image

可以下载图片,非常感谢项目作者
image

还修改过 crawler.py 文件这个地方,换行报语法错误,代码改成一行,没报错了
image

@gitxinyi
Copy link
Author

gitxinyi commented Nov 29, 2021 via email

@woyjuq
Copy link

woyjuq commented Nov 29, 2021

我部署的环境是Ubuntu, 无UI界面。需要安装chrome和对应版主的驱动才可以跑起来。 这个是网上刚搜索的安装方法 https://www.cnblogs.com/x54256/p/8403864.html (可能有问题,没测试,遇到问题就查一下,思路是这样的)

------------------ 原始邮件 ------------------ 发件人: @.>; 发送时间: 2021年11月24日(星期三) 下午4:20 收件人: @.>; 抄送: @.>; @.>; 主题: Re: [sczhengyabin/Image-Downloader] Error DevToolsActivePort file doesn't exist (#47) 在代码部署调试的时候,一直报这个错误, raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 查了一些资料,需要添加几个参数 “–no-sandbox”参数是让Chrome在root权限下跑 修改文件项目文件 crawler.py 330行左右,添加参数解决问题 chrome_options.add_argument('--no-sandbox') chrome_options.add_argument('--disable-dev-shm-usage') chrome_options.add_argument('--headless') 可以下载图片,非常感谢项目作者 还修改过 crawler.py 文件这个地方,换行报语法错误,代码改成一行,没报错了 你是Ubuntu吗 运行的时候必须要打开chrome吗 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

谢谢解答 前几天我自己弄好了 但好像只有必应Google能爬 百度的爬不了了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants