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

if Could not open URL. Please check your internet connection and/or ssl settings

Open liciciyi opened this issue 7 years ago • 8 comments

Evaluating... Could not open URL. Please check your internet connection and/or ssl settings Starting Download... Traceback (most recent call last): File "google_images_download.py", line 913, in main() File "google_images_download.py", line 905, in main paths = response.download(arguments) #wrapping response in a variable just for consistency File "google_images_download.py", line 860, in download items,errorCount,abs_path = self._get_all_items(raw_html,main_directory,dir_name,limit,arguments) #get all image items and download images File "google_images_download.py", line 706, in _get_all_items object, end_content = self._get_next_item(page) File "google_images_download.py", line 671, in _get_next_item start_line = s.find('rg_meta notranslate') AttributeError: 'NoneType' object has no attribute 'find'

the error is cause by ssl. you just need to add the context = ssl._create_unverified_context() resp = urllib.request.urlopen(req,context=context)

liciciyi avatar Nov 14 '18 07:11 liciciyi

Had same issue running in python 3.6. Tried in python 2.7 and it worked perfectly.

dsimerly avatar Dec 16 '18 19:12 dsimerly

@liciciyi What python version are you on? Does this happen consistently or intermittently? Also are you behind a proxy?

hardikvasa avatar May 16 '19 18:05 hardikvasa

@hardikvasa same error. happens consistently. not usable. no proxy.

yxchng avatar Jun 27 '19 14:06 yxchng

@hardikvasa I am having this error as well on Python 2.7, 3.7, and 3.8: At first my program will download images, and then after a while I start getting the error. If I restart my program, the error immediately persists. Restarting doesn't stop the error. After some time, a few hours, I try again and I am back to being able to download for a little bit.

manjaroblack avatar Jul 05 '19 22:07 manjaroblack

Same issue here - probably due to Google restrictions don't you think ? I have a delay of 0.5 seconds It worked for the 800 first searches and now it blocks almost immediately

pierrebinon avatar Sep 16 '19 13:09 pierrebinon

I have same problom, The exception is google_images_download.py 142 line. Is the google Anti-reptile problem?

ycyyww avatar Sep 29 '19 02:09 ycyyww

I get this exception on select images. I'm wondering if the fact that the header says User-Agent is "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36" that causes the problem.

hollowgalaxy avatar Oct 19 '19 18:10 hollowgalaxy

Hi all, I had the same error message. Here are some insights that might help you:

  1. In order to debug, change google_images_download.py as follows:

replace

req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req) #original
respData = str(resp.read())

with

context = ssl._create_unverified_context()
req = urllib.request.Request(url, headers=headers)
resp = urllib.request.urlopen(req,context=context)
respData = str(resp.read())

This doesn't solved the problem but gave me some more information.

  1. However what really solved this problem on my side was to uninstall Inkscape. The problem was that there was another version of Python installed under the Inkscape directory, and apparently it overwrote the path variable so every time I executed python, it would execute the one that was installed by Inkscape. So perhaps you could check if the correct version of Python gets executed.

which python

rotaugenlaubfrosch avatar May 26 '21 15:05 rotaugenlaubfrosch