Skip to content

Commit 0131763

Browse files
committed
Fix block location Basemap.arcgisimage for cachedir creation
1 parent d9c9ee7 commit 0131763

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/basemap/src/mpl_toolkits/basemap/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4361,9 +4361,6 @@ def arcgisimage(self, server="http://server.arcgisonline.com/ArcGIS",
43614361
# Generate a filename for the cached file.
43624362
filename = "%s-bbox-%s-%s-%s-%s-bboxsr%s-imagesr%s-size-%s-%s-dpi%s.png" % \
43634363
(service, xmin, ymin, xmax, ymax, self.epsg, self.epsg, xpixels, ypixels, dpi)
4364-
# Check if the cache directory exists, if not create it.
4365-
if not os.path.exists(cachedir):
4366-
os.makedirs(cachedir)
43674364
# Return fast if the image is already in the cache.
43684365
cache_path = os.path.join(cachedir, filename)
43694366
if os.path.isfile(cache_path):
@@ -4379,6 +4376,9 @@ def arcgisimage(self, server="http://server.arcgisonline.com/ArcGIS",
43794376
img = Image.open(conn)
43804377
# Save to cache if requested.
43814378
if cachedir is not None:
4379+
# Check if the cache directory exists, if not create it.
4380+
if not os.path.exists(cachedir):
4381+
os.makedirs(cachedir)
43824382
img.save(cache_path)
43834383
return self.imshow(img, ax=ax, origin="upper")
43844384

0 commit comments

Comments
 (0)