Raspberry Pi 4B上に組んでいたselemiumのテストをしていたところ、
途中から「selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service」というエラーを吐いて動かなくなりました
テスト中というのがミソで、正体はちゃんと閉じてないchromeがメモリをバカ食いして停止というのが真相。
実際のところ
無難に再起動
当時の状況はこんな感じ。
$ python3 sample.py start... Traceback (most recent call last): File "sample.py", line 25, in <module> driver = webdriver.Chrome(CHROME_DRIVER, options=options) File "/home/ubuntu/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__ self.service.start() File "/home/ubuntu/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 104, in start raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/lib/chromium-browser/chromedriver
最初の方は途切れ途切れ実行できたり出来なかったりだったのですが、ついには全く動かない事態に。
もしやと思い再起動をかけたら……動きました。
おそらく、chromiumのメモリがバカ食いしていたのが原因です。