1

I write some script to scrape from web.

When i run the script like this, it's works fine.

python bot.py

But, when the script starts from systemd

sudo systemctl start parser

it's failed with this error:

response = self.execute(Command.NEW_SESSION, parameters)
File "/home/mint/dev/parser/.virtualenv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 320,
self.error_handler.check_response(response)
File "/home/mint/dev/parser/.virtualenv/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 2
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error:      DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.39.562737 (dba483cee6a5f15e2e2d73df16968ab10b38a2bf),platform=Linux 4.4.0-130-generic x86_64)

My Unit File

[Unit]
Description=MyParser
After=network.target

[Service]
Type=simple
WorkingDirectory=/home/mint/dev/parser
Environment="PATH=/home/mint/dev/parser/.virtualenv/bin"
ExecStart=/home/mint/dev/parser/.virtualenv/bin/python bot.py

[Install]
WantedBy=multi-user.target
  • ChromeDriver 2.39.562737
  • Google Chrome 67.0.3396.99
  • Python 3.6.6
  • selenium 3.13.0
  • Ubuntu 16.04.4 LTS
seliseev
  • 81
  • 1
  • 5
  • same problem for me. upvoted! did you solve the problem? – Lead Developer Mar 28 '19 at 20:08
  • what was the fix? I'm having the same issue – TCB919 Jun 10 '20 at 09:01
  • 1
    Fixed my issue with systemd, **moved** my `X.service` file from `/etc/systemd/system/X.service` to `~/.config/systemd/user/X.service`, enabled the user service `systemctl --user enable X.service`, reloaded systemd files `sudo systemctl daemon-reload`, then started the user specific service `systemctl --user start X.service` - Hope this helps the next person – TCB919 Jun 10 '20 at 09:45

0 Answers0