Skip to content

Commit 07ae8f1

Browse files
committed
Set GMT_SESSION_NAME to a unique value so multiprocessing works on Windows
1 parent 12383e1 commit 07ae8f1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pygmt/session_management.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
"""
22
Modern mode session management modules.
33
"""
4+
import os
5+
import sys
6+
47
from pygmt.clib import Session
8+
from pygmt.helpers import unique_name
59

610

711
def begin():
@@ -12,6 +16,10 @@ def begin():
1216
1317
Only meant to be used once for creating the global session.
1418
"""
19+
# On Windows, need to set GMT_SESSION_NAME to a unique value
20+
if sys.platform == "win32":
21+
os.environ["GMT_SESSION_NAME"] = unique_name()
22+
1523
prefix = "pygmt-session"
1624
with Session() as lib:
1725
lib.call_module(module="begin", args=prefix)

0 commit comments

Comments
 (0)