diff --git a/exe/hooks/rthook.py b/exe/hooks/rthook.py index 53a9af14b6..ec0b3264a8 100644 --- a/exe/hooks/rthook.py +++ b/exe/hooks/rthook.py @@ -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') diff --git a/src/natcap/invest/__main__.py b/src/natcap/invest/__main__.py index 1f68c51913..167e0fc170 100644 --- a/src/natcap/invest/__main__.py +++ b/src/natcap/invest/__main__.py @@ -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__':