auino / cookidump

Easily dump cookidoo recipes
MIT License
147 stars 34 forks source link

Errors on chromedriver on Windows environments #11

Closed tsumetaihana closed 3 years ago

tsumetaihana commented 3 years ago

Hi Auino, firstly, thanks for your hard work and support on this. I'm very new in github and might ask a beginner questions. Please bear with me.

I tried to follow the instruction and believe i did those steps correctly, however, i'm having error when i execute cookidump.py. Please see the error log below:

C:\Users\ahwel\cookidump>python cookidump.py 'C:\Users\ahwel\cookidump\chromedriver.exe' 'C:\Users\ahwel\cookidump\cookidump-master\Test' [CD] Welcome to cookidump, starting things off... [CD] Complete the website domain: https://cookidoo.international Traceback (most recent call last): File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ahwel\cookidump\cookidump.py", line 237, in run(args.webdriverfile, args.outputdir, args.separate_json) File "C:\Users\ahwel\cookidump\cookidump.py", line 94, in run brw = startBrowser(webdriverfile) File "C:\Users\ahwel\cookidump\cookidump.py", line 31, in startBrowser driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options) File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe'' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Can you let me know whether my command is correct? Let me know if you have any clue from the error log above. The location of chromedriver.exe is C:\Users\ahwel\cookidump\

Thank you

auino commented 3 years ago

I just tested the whole system (on Mac/Linux systems) and I confirm it is working correctly. It may be an issue related to the chromedriver.exe file: you could try to download it again, or to pass it as .\chromedriver.exe. I assume here that you already installed all required dependencies and, of course, that Google Chrome is installed. Please let us know.

tsumetaihana commented 3 years ago

I tried to reinstalled the chromedriver.exe and still no luck. Below are my cookidump directory:

C:\Users\ahwel\cookidump>dir Volume in drive C is OS Volume Serial Number is DE0A-FE9D

Directory of C:\Users\ahwel\cookidump

22/08/2021 03:29 PM

. 22/08/2021 03:29 PM .. 17/07/2021 05:50 PM 11,177,472 chromedriver.exe 22/08/2021 01:38 PM 5,938,088 chromedriver_win32.zip 22/08/2021 01:35 PM 9,614 cookidump.py 22/08/2021 03:11 PM DLLs 22/08/2021 03:11 PM Doc 22/08/2021 02:17 PM 1,957,374 get-pip.py 22/08/2021 03:11 PM include 22/08/2021 03:11 PM Lib 22/08/2021 03:11 PM libs 28/06/2021 04:09 PM 32,628 LICENSE.txt 28/06/2021 04:10 PM 1,070,743 NEWS.txt 22/08/2021 03:28 PM 106,346 pip.exe 22/08/2021 03:28 PM 106,346 pip3.exe 28/06/2021 04:08 PM 101,608 python.exe 28/06/2021 04:08 PM 59,624 python3.dll 28/06/2021 04:08 PM 4,485,864 python39.dll 28/06/2021 04:08 PM 100,072 pythonw.exe 22/08/2021 01:35 PM 4,670 README.md 22/08/2021 01:35 PM 26 requirements.txt 22/08/2021 03:28 PM Scripts 22/08/2021 03:11 PM tcl 22/08/2021 03:11 PM Tools 28/06/2021 04:09 PM 97,160 vcruntime140.dll 28/06/2021 04:09 PM 37,256 vcruntime140_1.dll 16 File(s) 25,284,891 bytes 10 Dir(s) 12,384,129,024 bytes free

C:\Users\ahwel\cookidump>

I also try to install the python requirements again and it shows that i had already did that before:

C:\Users\ahwel\cookidump>pip install -r requirements.txt Requirement already satisfied: beautifulsoup4 in c:\users\ahwel\cookidump\lib\site-packages (from -r requirements.txt (line 1)) (4.9.3) Requirement already satisfied: selenium in c:\users\ahwel\cookidump\lib\site-packages (from -r requirements.txt (line 2)) (3.141.0) Requirement already satisfied: soupsieve>1.2 in c:\users\ahwel\cookidump\lib\site-packages (from beautifulsoup4->-r requirements.txt (line 1)) (2.2.1) Requirement already satisfied: urllib3 in c:\users\ahwel\cookidump\lib\site-packages (from selenium->-r requirements.txt (line 2)) (1.26.6)

would like to check with you, is the below command format correct?

C:\Users\ahwel\cookidump>python cookidump.py [--separate-json] 'C:\Users\ahwel\cookidump\chromedriver.exe' 'C:\Users\ahwel\cookidump\recipe'

I got error like below: C:\Users\ahwel\cookidump>python cookidump.py [--separate-json] 'C:\Users\ahwel\cookidump\chromedriver.exe' 'C:\Users\ahwel\cookidump\recipe' usage: cookidump.py [-h] [-s] webdriverfile outputdir cookidump.py: error: unrecognized arguments: 'C:\Users\ahwel\cookidump\recipe'

If i removed the outputdir, i can proceed further but returned with the same error as posted on top: C:\Users\ahwel\cookidump>python cookidump.py [--separate-json] 'C:\Users\ahwel\cookidump\chromedriver.exe' [CD] Welcome to cookidump, starting things off... [CD] Complete the website domain: https://cookidoo.international Traceback (most recent call last): File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ahwel\cookidump\cookidump.py", line 237, in run(args.webdriverfile, args.outputdir, args.separate_json) File "C:\Users\ahwel\cookidump\cookidump.py", line 94, in run brw = startBrowser(webdriverfile) File "C:\Users\ahwel\cookidump\cookidump.py", line 31, in startBrowser driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options) File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: '[--separate-json]' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

auino commented 3 years ago

Just run it as:

python cookidump.py 'C:\Users\ahwel\cookidump\chromedriver.exe' 'C:\Users\ahwel\cookidump\recipe'

without the [--separate-json] parameter.

Alternatively, run it as:

python cookidump.py '.\chromedriver.exe' '.\recipe'

tsumetaihana commented 3 years ago

C:\Users\ahwel\cookidump>python cookidump.py 'C:\Users\ahwel\cookidump\chromedriver.exe' 'C:\Users\ahwel\cookidump\recipe' [CD] Welcome to cookidump, starting things off... [CD] Complete the website domain: https://cookidoo.international Traceback (most recent call last): File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 72, in start self.process = subprocess.Popen(cmd, env=self.env, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 951, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Users\ahwel\cookidump\lib\subprocess.py", line 1420, in _execute_child hp, ht, pid, tid = _winapi.CreateProcess(executable, args, FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\ahwel\cookidump\cookidump.py", line 237, in run(args.webdriverfile, args.outputdir, args.separate_json) File "C:\Users\ahwel\cookidump\cookidump.py", line 94, in run brw = startBrowser(webdriverfile) File "C:\Users\ahwel\cookidump\cookidump.py", line 31, in startBrowser driver = webdriver.Chrome(executable_path=chrome_driver_path, options=chrome_options) File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\ahwel\cookidump\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe'' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Still no luck.... wonder where is the problem

auino commented 3 years ago

I suggest you to open a python prompt (on the same cookidoo folder including chromedriver.exe) and paste the following.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

webdriverfile = '.\chromedriver.exe'

chrome_options = Options()
brw = webdriver.Chrome(executable_path=webdriverfile, options=chrome_options)
brw.get('https://www.cookidoo.international')

Please check if it works.

tsumetaihana commented 3 years ago

Hi auino,

Thanks for the script. I manage to open the chromedriver.exe using the method above. The google Chrome browser opened and i'm able to land on cookidoo/international.

there are some error while i executing the script, I'm not sure it's normal or not:

Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

from selenium import webdriver from selenium.webdriver.chrome.options import Options webdriverfile = '.\chromedriver.exe' chrome_options = Options() brw = webdriver.Chrome(executable_path=webdriverfile, options=chrome_options)

DevTools listening on ws://127.0.0.1:7190/devtools/browser/35f15094-36cf-4fa0-82e6-e3a7c24ea14d

[19188:15536:0823/191456.158:ERROR:device_event_log_impl.cc(214)] [19:14:56.159] USB: usb_device_handle_win.cc:1048 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F) brw.get('https://www.cookidoo.international') [8912:15292:0823/191654.058:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is disabled

Next, how should I dump the recipe from the cookidoo website?

Thanks again for your help

auino commented 3 years ago

I'm not familiar with Windows environments, but I believe that the issue is related to your error, which I'm not sure depends on cookidump. Let's keep the issue opened, at least for now. (edit: closed due to inactivity)

tsumetaihana commented 3 years ago

thanks auino. Appreciate your effort

zelenooki87 commented 1 month ago

I had the same error. On Windows fix is to run with command python cookidump.py "chromedriver.exe" "output_directory" --separate-json