Skip to content

Commit 1f3d922

Browse files
committed
fix
1 parent 38b9aca commit 1f3d922

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pygmt/clib/session.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@
3434
tempfile_from_image,
3535
)
3636

37-
__libgmt__ = load_libgmt()
38-
3937
FAMILIES = [
4038
"GMT_IS_DATASET", # Entity is a data table
4139
"GMT_IS_GRID", # Entity is a grid
@@ -89,6 +87,9 @@
8987
np.datetime64: "GMT_DATETIME",
9088
}
9189

90+
# load the GMT library outside of the Session class so it's loaded once.
91+
_libgmt = load_libgmt()
92+
9293

9394
class Session:
9495
"""
@@ -310,7 +311,7 @@ def get_libgmt_func(self, name, argtypes=None, restype=None):
310311
<class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>
311312
"""
312313
if not hasattr(self, "_libgmt"):
313-
self._libgmt = __libgmt__
314+
self._libgmt = _libgmt
314315
function = getattr(self._libgmt, name)
315316
if argtypes is not None:
316317
function.argtypes = argtypes

0 commit comments

Comments
 (0)