No se me descargan las fotos de los osos de la leccion 2

if not path.exists():
path.mkdir()
for o in bear_types:
dest = (path/o)
dest.mkdir(exist_ok=True)
results = search_images_bing(key, f’{o} bear’)
download_images (dest, urls = results.attrgot (‘contentUrl’))

BrokenProcessPool Traceback (most recent call last)
in
5 dest.mkdir(exist_ok=True)
6 results = search_images_bing(key, f’{o} bear’)
----> 7 download_images (dest, urls = results.attrgot (‘contentUrl’))

E:\Usuario\Descargas\PYTHON\APP\lib\site-packages\fastai\vision\utils.py in download_images(dest, url_file, urls, max_pics, n_workers, timeout, preserve_filename)
36 dest.mkdir(exist_ok=True)
37 parallel(partial(_download_image_inner, dest, timeout=timeout, preserve_filename=preserve_filename),
—> 38 list(enumerate(urls)), n_workers=n_workers)
39
40 # Cell

E:\Usuario\Descargas\PYTHON\APP\lib\site-packages\fastcore\parallel.py in parallel(f, items, n_workers, total, progress, pause, threadpool, timeout, chunksize, *args, **kwargs)
104 if total is None: total = len(items)
105 r = progress_bar(r, total=total, leave=False)
–> 106 return L®
107
108 # Cell

E:\Usuario\Descargas\PYTHON\APP\lib\site-packages\fastcore\foundation.py in call(cls, x, *args, **kwargs)
95 def call(cls, x=None, *args, **kwargs):
96 if not args and not kwargs and x is not None and isinstance(x,cls): return x
—> 97 return super().call(x, *args, **kwargs)
98
99 # Cell

E:\Usuario\Descargas\PYTHON\APP\lib\site-packages\fastcore\foundation.py in init(self, items, use_list, match, *rest)
103 def init(self, items=None, *rest, use_list=False, match=None):
104 if (use_list is not None) or not is_array(items):
–> 105 items = listify(items, *rest, use_list=use_list, match=match)
106 super().init(items)
107

E:\Usuario\Descargas\PYTHON\APP\lib\site-packages\fastcore\basics.py in listify(o, use_list, match, *rest)
54 elif isinstance(o, list): res = o
55 elif isinstance(o, str) or is_array(o): res = [o]
—> 56 elif is_iter(o): res = list(o)
57 else: res = [o]
58 if match is not None:

E:\Usuario\Descargas\PYTHON\APP\lib\concurrent\futures\process.py in _chain_from_iterable_of_lists(iterable)
481 careful not to keep references to yielded objects.
482 “”"
–> 483 for element in iterable:
484 element.reverse()
485 while element:

E:\Usuario\Descargas\PYTHON\APP\lib\concurrent\futures_base.py in result_iterator()
596 # Careful not to keep a reference to the popped future
597 if timeout is None:
–> 598 yield fs.pop().result()
599 else:
600 yield fs.pop().result(end_time - time.monotonic())

E:\Usuario\Descargas\PYTHON\APP\lib\concurrent\futures_base.py in result(self, timeout)
433 raise CancelledError()
434 elif self._state == FINISHED:
–> 435 return self.__get_result()
436 else:
437 raise TimeoutError()

E:\Usuario\Descargas\PYTHON\APP\lib\concurrent\futures_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
–> 384 raise self._exception
385 else:
386 return self._result

BrokenProcessPool: A process in the process pool was terminated abruptly while the future was running or pending.

Our folder has image files, as we’d expect:

fns = get_image_files(path)
fns
(#0) []
j: I just love this about working in Jupyter notebooks! It’s so easy to gradually build what I want, and check my work every step of the way. I make a lot of mistakes, so this is really helpful to me…

Often when we download files from the internet, there are a few that are corrupt. Let’s check:

failed = verify_images(fns)
failed
(#0) []