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

instanciating WhatsApp() fails #103

Open
leggewie opened this issue Jan 17, 2023 · 3 comments
Open

instanciating WhatsApp() fails #103

leggewie opened this issue Jan 17, 2023 · 3 comments

Comments

@leggewie
Copy link
Contributor

I got alright to work at least twice, but oftentimes it fails again the next day or after recreating the venv. I'm having trouble to troubleshoot and pinpoint the exact problem, to be honest. So, I will give as much information in order to find out what is going wrong.

My system runs Ubuntu Jammy. I created a venv with "python -m venv alright" and activate as "source alright/bin/activate", then "pip3 install alright". Sometimes it works and then sometimes it breaks for no immediately obvious reason.

I hope for some guidance to be able to look into and understand what is going wrong. The "DevToolsActivePort file doesn't exist"-error from selenium is very generic.

(alright) leggewie@work:~/bin$ python -c "from alright import WhatsApp;messenger = WhatsApp()"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/alright/__init__.py", line 37, in __init__
    browser = webdriver.Chrome(
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    super().__init__(
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 106, in __init__
    super().__init__(
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 288, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 381, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 444, in execute
    self.error_handler.check_response(response)
  File "/home/leggewie/bin/alright/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 249, in check_response
    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 /snap/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x5623bb8fd303 <unknown>
#1 0x5623bb6d1d37 <unknown>
#2 0x5623bb6fa157 <unknown>
#3 0x5623bb6f6330 <unknown>
#4 0x5623bb7374a6 <unknown>
#5 0x5623bb72e753 <unknown>
#6 0x5623bb701a14 <unknown>
#7 0x5623bb702b7e <unknown>
#8 0x5623bb94c32e <unknown>
#9 0x5623bb94fc0e <unknown>
#10 0x5623bb932610 <unknown>
#11 0x5623bb950c23 <unknown>
#12 0x5623bb924545 <unknown>
#13 0x5623bb9716a8 <unknown>
#14 0x5623bb971836 <unknown>
#15 0x5623bb98cd13 <unknown>
#16 0x7f2e7dba6b43 <unknown>

Selenium in general works, though. The following code exits with 0 and a
browser window pops up briefly.

(alright) leggewie@work:~/bin$ python -c "from selenium import webdriver;driver = webdriver.Chrome()";echo $?
0

Some information about my system:

(alright) leggewie@work:~/bin$ python -c "import sys;print(sys.path)"
['', '/usr/lib/python310.zip', '/usr/lib/python3.10', '/usr/lib/python3.10/lib-dynload', '/home/leggewie/bin/alright/lib/python3.10/site-packages']

(alright) leggewie@work:~/bin$ pip list
Package            Version
------------------ ---------
alright            2.4
async-generator    1.10
attrs              22.2.0
certifi            2022.12.7
charset-normalizer 3.0.1
exceptiongroup     1.1.0
h11                0.14.0
idna               3.4
outcome            1.2.0
packaging          23.0
pip                22.0.2
PySocks            1.7.1
python-dotenv      0.21.0
requests           2.28.2
selenium           4.7.2
setuptools         59.6.0
sniffio            1.3.0
sortedcontainers   2.4.0
tqdm               4.64.1
trio               0.22.0
trio-websocket     0.9.2
urllib3            1.26.14
webdriver-manager  3.8.5
wsproto            1.2.0
@rafamelo01
Copy link

rafamelo01 commented Jan 17, 2023

Same here and this error log:
[4924:7236:0117/154006.283:ERROR:interface_endpoint_client.cc(695)] Message 1 rejected by interface blink.mojom.WidgetHost

@leggewie
Copy link
Contributor Author

leggewie commented Jan 17, 2023

@rafamelo01 How did you get that particular error, where is the error log located?

Could this be a regression in the latest chromium?

Edit: FWIW, hardcoding line 38 of init.py as ChromeDriverManager(version="108.0.5359.71").install(), does not change the situation for me, so most likely not a regression.

@leggewie
Copy link
Contributor Author

leggewie commented Feb 4, 2023

note to self: One thing you should not do is to call alright from within a directory containing alright source code, specifically one containing alright/init.py

@Kalebu Are you aware of a special meaning of a directory called User_Data for selenium? I am getting more and more certain that this problem has a lot to do with #104 FWIW, #107 breaks a currently working setup. I just don't see why.

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