728x90
반응형

배경

Image Classification을 하기 위해 데이터 수집을 진행해야 했다. 다량의 이미지를 확보하기 위해 google-images-download 패키지를 이용하기로 했다. 간단한 example을 수행해 보았지만 Error가 발생하고 진행되지 않는다.

Github - google_images_download

https://github.com/Joeclinton1/google-images-download

문제

아래와 같은 에러가 발생한다.

'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/Users/nachangju/Documents/00_Development/00_Workspace/80_KAIST_Project/code/google-images-download/crawling.py", line 11, in <module>
    paths = response.download(arguments)   #passing the arguments to the function
  File "/Users/nachangju/Documents/00_Development/00_Workspace/80_KAIST_Project/code/google-images-download/google_images_download_local/google_images_download.py", line 970, in download
    paths, errors = self.download_executor(arguments)
  File "/Users/nachangju/Documents/00_Development/00_Workspace/80_KAIST_Project/code/google-images-download/google_images_download_local/google_images_download.py", line 1118, in download_executor
    items, errorCount, abs_path = self._get_all_items(images, main_directory, dir_name, limit,
  File "/Users/nachangju/Documents/00_Development/00_Workspace/80_KAIST_Project/code/google-images-download/google_images_download_local/google_images_download.py", line 906, in _get_all_items
    object['image_link'], object['image_format'], main_directory, dir_name, count,
TypeError: 'NoneType' object is not subscriptable

해결

google_images_download.py의 407라인을 수정하자

as is

info = data[11]

to be

info = data[25]

참고 : https://github.com/Joeclinton1/google-images-download/issues/30

728x90
반응형

+ Recent posts