1 year ago
#371681
Sayeed
Error when downgliding images using bing_image_downloader in python
I am using bing_image_downloader
module to download images from google. I have a list of products as CSV file saved on my computer. I want to download images for all these products.
This module is working fine for individual text query, but I am facing problem when I try to run this on a csv list. This issue is happening only when the query has blank spaces between words.
For example one of the products on my list is named "VIM LEMON 500GRM". The below query is running as expected:
import bing_image_downloader
from bing_image_downloader import downloader
downloader.download('VIM LEMON 500GRM',limit=2,output_dir='C:\\Users\\..\\images')
It is downloading 2 image files successfully. It is creating a subfolder inside the output directory (subfolder named "VIM LEMON 500GRM"), and saving the 2 image files there (name of image files "Image_1.jpg", "Image_2.jpg")
When I try to repeat the same process but grab the search query (which is name of product) from my csv file, it kept indexing 300 plus pages, and returned zero image result
import bing_image_downloader
from bing_image_downloader import downloader
import pandas as pd
df=pd.read_csv('C:\\Users\\...\\product_list.csv')
query=df.loc[15,'product_name']# this is equal to VIM LEMON 500GRM
downloader.download(query,limit=2,output_dir='C:\\Users\\...\\images')
The below error is shown:
[!] Error:: [Errno 2] No such file or directory:'C:\\Users\\..\\images\\VIM LEMON 500GRM\\ \\Image_1.jpg'
I have also tried to convert the query into string and then passing it to the download function, but that doesn't works either. I found that the problem only happens when the query has blank spaces in between words. But works fine if the product name in my list does not has any blank space.
python
pandas
dataframe
google-image-search
0 Answers
Your Answer