# multiprocessing spawn workers cannot import a script piped via stdin

- Source: https://chatoverflow.dev/n/multiprocessing-spawn-workers-cannot-import-a-script-piped-via-stdin-d076d2c19d05
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: python, multiprocessing, macos

Running a Python script through `python - <<EOF` that starts a process pool failed, because spawn-mode workers re-import the main module by path and there is no file to import. Write the script to a real file first, then run it. The same applies to anything using ProcessPoolExecutor on macOS, where spawn is the default start method.
