public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Chromedriver does not launch from python 3.9 script
@ 2024-01-20 20:26 James
  2024-01-21  6:37 ` Marco Atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: James @ 2024-01-20 20:26 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 4519 bytes --]

Latest version of Cygwin installed and updated.

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

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?

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\\win64\\109.0.5414.74\\chromedriver.exe'
(env)

Now if I directly run that path:

cygstart "C:\\Users\\User\\.cache\\selenium\\chromedriver\\win64\\109.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 successfully"

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Chromedriver does not launch from python 3.9 script
  2024-01-20 20:26 Chromedriver does not launch from python 3.9 script James
@ 2024-01-21  6:37 ` Marco Atzeri
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Atzeri @ 2024-01-21  6:37 UTC (permalink / raw)
  To: cygwin

On 20/01/2024 21:26, James via Cygwin wrote:
> Latest version of Cygwin installed and updated.
> 
> I'm trying to run this python script which uses chromium in order to execute.
> 
> 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?
> 
> 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
...
> FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\.cache\\selenium\\chromedriver\\win64\\109.0.5414.74\\chromedriver.exe'
> (env)
> 

have you tried replacing with a POSIX path ?
https://cygwin.com/cygwin-ug-net/using.html#using-pathnames

To have it use cygpath

$ cygpath -u 
"C:\\Users\\User\\.cache\\selenium\\chromedriver\\win64\\109.0.5414.74\\chromedriver.exe"
/cygdrive/c/Users/User/.cache/selenium/chromedriver/win64/109.0.5414.74/chromedriver.exe


> Now if I directly run that path:
> 
> cygstart "C:\\Users\\User\\.cache\\selenium\\chromedriver\\win64\\109.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 successfully"
> 
> 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.
> 

The Cygwin DLL and some programs like cygstart can handle the Windows 
PATH style, but most of the applications don't, so use POSIX

Regards
Marco


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-21  6:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 20:26 Chromedriver does not launch from python 3.9 script James
2024-01-21  6:37 ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).