google-images-download icon indicating copy to clipboard operation
google-images-download copied to clipboard

Error with trailing spaces in query

Open therealpeterpython opened this issue 4 years ago • 0 comments

Hey again :D

I've found another bug. Related to #34.

When you have spaces at the end of your searchwords then you can't download an image and dont get the path. After quite some research i've got to line 637 output_file = open(path, 'wb') which fails in this case. I think the best way to tackle this problem is to strip the searchwords. If i've got it right you could do that in lines 849-850 like this:

if arguments['keywords']:
    search_keyword = [str(item).STRIP() for item in arguments['keywords'].split(',')] 

and perhaps in the keywords_from_file() method.

Greetings, therealpeterpython

therealpeterpython avatar Aug 31 '19 22:08 therealpeterpython