Python 3.6 - image scraping with google-image-download

Viewed 2464

I want to crawl some images for my machine learning practice and found this google-image-download to very useful and the codes works out of the box.

However, at the moment, it only allow not more than 100 images, which is the limit from google image page(that only load 100 images per page).

The document said if you are using pip install google_images_download(which in my case, I am doing that), it will download together with selenium and by using chromedriver, you can download more than that limit.

however, everytime I run the code python gimages.py:

from google_images_download import google_images_download  

response = google_images_download.googleimagesdownload() 

arguments = {"keywords":"number plates","limit":200,"print_urls":True}  
paths = response.download(arguments)
print(paths) 

I will get error:

Looks like we cannot locate the path the 'chromedriver' (use the '--chromedriver' argument to specify the path to the executable.) or google chrome browser is not installed on your machine (exception: expected str, bytes or os.PathLike object, not NoneType)

as I checked my installation, selenium already installed: enter image description here

  1. reading further, it said I can download chromedriver and put inside the same folder and call python gimages.py --chromedriver "chromedriver", I still get the same error.

How can I resolve this?

I am using conda with python 3.6, running the terminal from conda. the code is already working, just that chromedriver part is not.

1 Answers

You need to specify the path... "chromedriver" is not a path...

You might need to the explicit path "/path/to/chromedriver/folder".

In your case: python gimages.py --chromedriver "/path/to/chromedriver/folder"

Hope this helps you!

Related