---------------------------------------------------------------------------
UnidentifiedImageError Traceback (most recent call last)
<timed exec> in <module>
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/contextily/plotting.py in add_basemap(ax, zoom, source, interpolation, attribution, attribution_size, reset_extent, crs, resampling, url, **extra_imshow_args)
141 )
142 # Download image
--> 143 image, extent = bounds2img(
144 left, bottom, right, top, zoom=zoom, source=source, ll=False
145 )
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/contextily/tile.py in bounds2img(w, s, e, n, zoom, source, ll, wait, max_retries, url)
246 x, y, z = t.x, t.y, t.z
247 tile_url = _construct_tile_url(provider, x, y, z)
--> 248 image = _fetch_tile(tile_url, wait, max_retries)
249 tiles.append(t)
250 arrays.append(image)
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/joblib/memory.py in __call__(self, *args, **kwargs)
589
590 def __call__(self, *args, **kwargs):
--> 591 return self._cached_call(args, kwargs)[0]
592
593 def __getstate__(self):
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/joblib/memory.py in _cached_call(self, args, kwargs, shelving)
532
533 if must_call:
--> 534 out, metadata = self.call(*args, **kwargs)
535 if self.mmap_mode is not None:
536 # Memmap the output at the first call to be consistent with
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/joblib/memory.py in call(self, *args, **kwargs)
759 if self._verbose > 0:
760 print(format_call(self.func, args, kwargs))
--> 761 output = self.func(*args, **kwargs)
762 self.store_backend.dump_item(
763 [func_id, args_id], output, verbose=self._verbose)
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/contextily/tile.py in _fetch_tile(tile_url, wait, max_retries)
303 request = _retryer(tile_url, wait, max_retries)
304 with io.BytesIO(request.content) as image_stream:
--> 305 image = Image.open(image_stream).convert("RGBA")
306 array = np.asarray(image)
307 image.close()
/opt/hostedtoolcache/Python/3.8.10/x64/lib/python3.8/site-packages/PIL/Image.py in open(fp, mode, formats)
3021 for message in accept_warnings:
3022 warnings.warn(message)
-> 3023 raise UnidentifiedImageError(
3024 "cannot identify image file %r" % (filename if filename else fp)
3025 )
UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x7f62b76da400>