Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'NoneType' object is not subscriptable #356

Open
rafarios opened this issue Sep 25, 2021 · 5 comments
Open

TypeError: 'NoneType' object is not subscriptable #356

rafarios opened this issue Sep 25, 2021 · 5 comments

Comments

@rafarios
Copy link

Hi. Using 2.8.0, It was working properly yesterday, buy today I receive this error. Can you review it?

Traceback (most recent call last):
File "/usr/local/bin/googleimagesdownload", line 11, in
load_entry_point('google-images-download==2.8.0', 'console_scripts', 'googleimagesdownload')()
File "/usr/local/lib/python3.7/dist-packages/google_images_download-2.8.0-py3.7.egg/google_images_download/google_images_download.py", line 1134, in main
File "/usr/local/lib/python3.7/dist-packages/google_images_download-2.8.0-py3.7.egg/google_images_download/google_images_download.py", line 952, in download
File "/usr/local/lib/python3.7/dist-packages/google_images_download-2.8.0-py3.7.egg/google_images_download/google_images_download.py", line 1087, in download_executor
File "/usr/local/lib/python3.7/dist-packages/google_images_download-2.8.0-py3.7.egg/google_images_download/google_images_download.py", line 888, in _get_all_items
TypeError: 'NoneType' object is not subscriptable

@NicolasGrosjean
Copy link

Hi @rafarios,

Have you the same issue with the Joeclinton1 version which is more up to date ?

You can install it with

git clone https://github.com/Joeclinton1/google-images-download.git
cd google-images-download && python setup.py install

@is0356xi
Copy link

'183836587' is no longer included in 'image_object'.
In my case, I commented out line 391 of google_images_download.py and now I can run it.

def format_object(self, object):
        data = object[1]
        main = data[3]
        info = data[9]
        if info is None:
            info = data[11]
        formatted_object = {}
        try:
            formatted_object['image_height'] = main[2]
            formatted_object['image_width'] = main[1]
            formatted_object['image_link'] = main[0]
            formatted_object['image_format'] = main[0][-1 * (len(main[0]) - main[0].rfind(".") - 1):]
            formatted_object['image_description'] = info['2003'][3]
            # formatted_object['image_host'] = info['183836587'][0]
            formatted_object['image_source'] = info['2003'][2]
            formatted_object['image_thumbnail_url'] = data[2][0]
        except Exception as e:
            print(e)
            return None
            
        return formatted_object

@rafarios
Copy link
Author

Thanks @is0356xi

Now it works!

@Joeclinton1
Copy link

I implemented a fix in the most recent commit by changing the location of image_host. Should work now :)

@moisty70
Copy link

moisty70 commented Oct 19, 2023

I cannot get it to work:

Item no.: 1 --> Item name = Polar bears
Evaluating...
Starting Download...
'NoneType' object is not subscriptable
Traceback (most recent call last):
File "/cygdrive/d/dev/git/pythonaf/testGDI.py", line 6, in
paths = response.download(arguments) #passing the arguments to the function
File "/usr/lib/python3.9/site-packages/google_images_download-2.8.0-py3.9.egg/google_images_download/google_images_download.py", line 970, in download
File "/usr/lib/python3.9/site-packages/google_images_download-2.8.0-py3.9.egg/google_images_download/google_images_download.py", line 1118, in download_executor
File "/usr/lib/python3.9/site-packages/google_images_download-2.8.0-py3.9.egg/google_images_download/google_images_download.py", line 906, in _get_all_items
TypeError: 'NoneType' object is not subscriptable

testGDI.py is:

from google_images_download import google_images_download #importing the library

response = google_images_download.googleimagesdownload() #class instantiation

arguments = {"keywords":"Polar bears,baloons,Beaches","limit":20,"print_urls":True} #creating list of arguments
paths = response.download(arguments) #passing the arguments to the function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants