diff --git a/pygmt/session_management.py b/pygmt/session_management.py index 4bb829835b9..750157679d4 100644 --- a/pygmt/session_management.py +++ b/pygmt/session_management.py @@ -1,7 +1,11 @@ """ Modern mode session management modules. """ +import os +import sys + from pygmt.clib import Session +from pygmt.helpers import unique_name def begin(): @@ -12,6 +16,10 @@ def begin(): Only meant to be used once for creating the global session. """ + # On Windows, need to set GMT_SESSION_NAME to a unique value + if sys.platform == "win32": + os.environ["GMT_SESSION_NAME"] = unique_name() + prefix = "pygmt-session" with Session() as lib: lib.call_module(module="begin", args=prefix)