From 47fe3fde83c96389f01e09d6a326697063908956 Mon Sep 17 00:00:00 2001 From: Alexander Maas Date: Mon, 23 Nov 2020 08:04:22 +0100 Subject: [PATCH] Wrap global code in if-statement as per https://stackoverflow.com/questions/60691363/runtimeerrorfreeze-support-on-mac#:~:text=This%20probably%20means%20that%20you,frozen%20to%20produce%20an%20executable. --- poker_ai/ai/agent.py | 3 ++- poker_ai/ai/multiprocess/server.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/poker_ai/ai/agent.py b/poker_ai/ai/agent.py index 78b65ebd..64b63c5e 100644 --- a/poker_ai/ai/agent.py +++ b/poker_ai/ai/agent.py @@ -5,7 +5,8 @@ import joblib -manager = mp.Manager() +if __name__ == "__main__": + manager = mp.Manager() class Agent: diff --git a/poker_ai/ai/multiprocess/server.py b/poker_ai/ai/multiprocess/server.py index a4226602..949a4670 100644 --- a/poker_ai/ai/multiprocess/server.py +++ b/poker_ai/ai/multiprocess/server.py @@ -12,8 +12,9 @@ from poker_ai.games.short_deck import state from poker_ai.ai.multiprocess.worker import Worker -log = logging.getLogger("sync.server") -manager = mp.Manager() +if __name__ == "__main__": + log = logging.getLogger("sync.server") + manager = mp.Manager() class Server: