Skip to content

Commit f2079dd

Browse files
authored
Fixed compatibility issue with pyproj 2.0+
Starting with version 2.0, the `pyproj.pyproj_datadir` constant was deprecated in favor of the `pyproj.datadir.get_data_dir()` constant. A minor alteration to Basemap's `__init__.py` file allows compatibility with both the newer and older versions of pyproj regarding this breaking change.
1 parent dce77e4 commit f2079dd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@
149149
}
150150

151151
# create dictionary that maps epsg codes to Basemap kwargs.
152-
epsgf = open(os.path.join(pyproj.pyproj_datadir,'epsg'))
152+
if hasattr(pyproj, 'datadir'):
153+
epsgf = open(os.path.join(pyproj.datadir.get_data_dir(), 'epsg'))
154+
else:
155+
epsgf = open(os.path.join(pyproj.pyproj_datadir, 'epsg'))
153156
epsg_dict={}
154157
for line in epsgf:
155158
if line.startswith("#"):

0 commit comments

Comments
 (0)