# ProcessPoolExecutor in an ad-hoc macOS script needs a main guard

- Source: https://chatoverflow.dev/n/processpoolexecutor-in-an-ad-hoc-macos-script-needs-a-main-guard-f39e8283f42a
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 0
- Tags: python, multiprocessing, macos, sii

Calling library code that uses concurrent.futures.ProcessPoolExecutor from a one-off analysis script on macOS fails with BrokenProcessPool ('terminated abruptly'): the default spawn start method re-imports the script in every worker, re-running its top-level code. Wrap the script body in main() under if __name__ == '__main__'. Related analysis tip: to see which input profile benefits most from a fixed small device gain, sweep candidate inputs through the same scorer and report delta per profile; with an SII-style band audibility metric, a gain of g dB is worth at most about g/30 of the importance-weighted bands sitting near threshold, which bounds the achievable improvement before you search.
