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

"TypeError: Binary Location Must be a String" on Linux Mint with basic code #2011

Open
laoraryn opened this issue Sep 8, 2024 · 2 comments

Comments

@laoraryn
Copy link

laoraryn commented Sep 8, 2024

Hi, I found this library today and I've been trying to implement it for several hours. I started with the basic code in the README, and also tried the code in the pinned message on the discussion board, but neither work. I keep getting the TypeError in the title above. I see several other issues opened for similar issues, none of which have any solutions posted - 1, 2, 3.

I'm running Linux Mint 21.3 Cinnamon and Python 3.10.12

My code:

import undetected_chromedriver as uc
driver = uc.Chrome()
driver.get('https://www.google.com')

The output:

Exception has occurred: TypeError
Binary Location Must be a String
  File "xxx", line 2, in <module>
    driver = uc.Chrome()
             ^^^^^^^^^^^
TypeError: Binary Location Must be a String

Confirmation of versions, locations from command line:

$ google-chrome --version
Google Chrome 128.0.6613.119 

$ chromedriver --version
ChromeDriver 128.0.6613.119 (6e439cfca4deda5954b0c74cde9b521c03cb31ad-refs/branch-heads/6613@{#1464})

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

$ whereis google-chrome
google-chrome: /usr/bin/google-chrome /usr/share/man/man1/google-chrome.1.gz

$ whereis chromedriver
chromedriver: /usr/bin/chromedriver

I also found this thread with a solution that appeared to work for others, however it just gives me a different error:

My code:

import undetected_chromedriver as uc
options = uc.ChromeOptions()
driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/google-chrome", driver_executable_path="/tmp/chromedriver")
driver.get('https://nowsecure.nl')

The output:

Exception has occurred: FileNotFoundError
[Errno 2] No such file or directory: '/tmp/chromedriver'
  File "xxx", line 3, in <module>
    driver = uc.Chrome(options = options, browser_executable_path="/usr/bin/chromium", driver_executable_path="/tmp/chromedriver")
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/chromedriver'

(I tried it with /usr/bin/chromedriver also, just in case, but I got the same FileNotFoundError.)

I'm relatively new to Chromedriver and Linux in general, so it's entirely possible I'm missing something obvious, but I've been hitting my head against this for too long! Any help would be appreciated :)

@jasongst
Copy link

Hello, I resolved the problem on Ubuntu by installing chromium with snap
sudo snap install chromium

I think snap is not available on Linux Mint but you can still install it with
sudo apt install snapd

I hope this solves your problem

@laoraryn
Copy link
Author

Hello, I resolved the problem on Ubuntu by installing chromium with snap sudo snap install chromium

I think snap is not available on Linux Mint but you can still install it with sudo apt install snapd

I hope this solves your problem

Thanks for the suggestion! Unfortunately it didn't solve the problem for me, I'm still getting the same error :/

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