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

Chromedriver Crashes when Program is run outside of loconotion folder #61

Open
ghost opened this issue May 21, 2021 · 1 comment
Open

Comments

@ghost
Copy link

ghost commented May 21, 2021

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/loconotion/loconotion/__main__.py", line 144, in <module>
    main()
  File "/home/ubuntu/loconotion/loconotion/__main__.py", line 134, in main
    Parser(config=parsed_config, args=vars(args))
  File "/home/ubuntu/loconotion/loconotion/notionparser.py", line 84, in __init__
    self.driver = self.init_chromedriver()
  File "/home/ubuntu/loconotion/loconotion/notionparser.py", line 240, in init_chromedriver
    return webdriver.Chrome(
  File "/home/ubuntu/.local/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/home/ubuntu/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/ubuntu/.local/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/chromedriver unexpectedly exited. Status code was: 1

I ran my script from the home folder, and I got this error. When I run my autoupload-to-ghpages script (that exists in the home folder) inside the loconotion directory, it runs fine. What's going on?

For now, I'll specify to cd to the loconotion directory inside the script, but I just thought that this was weird.

@sueszli
Copy link

sueszli commented Mar 27, 2023

I was able to reproduce and resolve this bug by using the webdriver_manager.chrome dependency which automatically sets the correct relative path to the driver executable, no matter what directory you are in.

You can check it out here: https://github.com/sueszli/notionSnapshot/blob/master/notionsnapshot/driver.py

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

1 participant