Skip to content

Commit

Permalink
Moving multiprocessing.freeze_support() to __main__.py. RE:natcap#1622
Browse files Browse the repository at this point in the history
  • Loading branch information
phargogh committed Sep 11, 2024
1 parent 948806c commit 1bbbfb2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions exe/hooks/rthook.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import sys
import os
import multiprocessing
import platform

multiprocessing.freeze_support()
import sys

os.environ['PROJ_LIB'] = os.path.join(sys._MEIPASS, 'proj')

Expand Down
6 changes: 6 additions & 0 deletions src/natcap/invest/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import multiprocessing
import sys

# We want to guarantee that this is called BEFORE any other processes start,
# which could happen at import time.
if __name__ == '__main__':
multiprocessing.freeze_support()

from . import cli

if __name__ == '__main__':
Expand Down

0 comments on commit 1bbbfb2

Please sign in to comment.