Zend certified PHP/Magento developer

Chromedriver not found in Cygwin although it exists

After a couple hours of trying everything I could, I’m posting the question here.

I’m trying to run this python script which uses chromium in order to execute.

https://github.com/FallingLights/Teachable-dl

I got it all installed, and I’m just now trying to run the script and login, but it keeps saying it cannot find the chromedriver.exe.

But the file exists and I know it’s looking in the right place because I pasted the linux version in the same spot and renamed it to chromedriver.exe and it gave me an error about running a 16 bit program. I also dropped in the latest version from the google archive for chromedriver.exe and when I ran the script, it said the new version was not compatible with my current version, so I know for a fact it is reading the file.

So why is it telling me it doesn’t exist?

Moreover, I cannot seem to install chromium in cygwin. Everything from chromium-browser, chromium, chrome, chrome-browser, but it isn’t found. I used the cygwin package installer (setup) but chromium or chrome are not found in the package isntaller list even when I change the dropdown to All.

apt-cyg install chromium-browser
Installing chromium-browser
Unable to locate package chromium-browser

apt-cyg install chromium
Installing chromium
Unable to locate package chromium

But, this works:

$ pip show selenium
Name: selenium
Version: 4.16.0
Summary:
Home-page: https://www.selenium.dev
Author:
Author-email:
License: Apache 2.0
Location: /home/User/Teachable-Dl/env/lib/python3.9/site-packages
Requires: certifi, trio, trio-websocket, urllib3
Required-by: seleniumbase

In any case, here is the error I get when I try to run the script:

User@User-PC ~/Teachable-Dl
$ python3 main.py --url https://courseurl.com/courses/enrolled/869509 --man_login_url https://sso.teachable.com/secure/1096/identity/login/password --verbose
Traceback (most recent call last):
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/seleniumbase/core/browser_launcher.py", line 2963, in get_local_driver
    if os.path.exists(LOCAL_CHROMEDRIVER):
  File "/usr/lib/python3.9/genericpath.py", line 19, in exists
    os.stat(path)
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/User/Teachable-Dl/main.py", line 789, in <module>
    downloader = TeachableDownloader(verbose_arg=verbose, complete_lecture_arg=args.complete_lecture,
  File "/home/User/Teachable-Dl/main.py", line 52, in __init__
    self.driver = Driver(uc=True, headed=True)
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/seleniumbase/plugins/driver_manager.py", line 488, in Driver
    driver = browser_launcher.get_driver(
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/seleniumbase/core/browser_launcher.py", line 1591, in get_driver
    return get_local_driver(
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/seleniumbase/core/browser_launcher.py", line 3839, in get_local_driver
    driver = webdriver.Chrome(service=service)
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    self.service.start()
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self._start_process(self._path)
  File "/home/User/Teachable-Dl/env/lib/python3.9/site-packages/selenium/webdriver/common/service.py", line 208, in _start_process
    self.process = subprocess.Popen(
  File "/usr/lib/python3.9/subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.9/subprocess.py", line 1821, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\User\.cache\selenium\chromedriver\win649.0.5414.74\chromedriver.exe'
(env)

Now if I directly run that path:

cygstart "C:\Users\User\.cache\selenium\chromedriver\win649.0.5414.74\chromedriver.exe"

It runs same as clicking on it, so the file exists and the path is right. The popup window is a command window which starts with “Starting ChromeDriver 109….” and the last line is “ChromeDriver was started sucessfully”

But the same file is saying doesn’t exist when I try to run the script.

I also pasted the chromedriver.exe file into /env/bin/ folder in the working directory, but it still says doesn’t exist, yet now it says the file at the new correct path doesn’t exist, so in other words it detected and found it at the new location but still is saying it didn’t exist but it does.

Also, if I delete the folder at that path and then run the script again, it still fails but it also creates the directory at that path and puts the chromedriver.exe in the directory – that means it literally put the file there itself but it’s saying that it isn’t found.

What is going on and how can I fix this issue?