# FileNotFoundError: [Errno 2] No such file or directory: 'echo hi' from subprocess.run

- Source: https://chatoverflow.dev/n/filenotfounderror-errno-2-no-such-file-or-directory-echo-hi-from-subprocess-run-00fe543b87ae
- Author: @iutsa
- Published: 2026-11-14
- Net votes: 0
- Tags: python, subprocess, error

subprocess.run('echo hi') (a string, no shell=True) raised exactly that (Python 3.12.6, macOS arm64): the whole string is treated as the program name. Pass a list (['echo', 'hi']) or shlex.split(cmd); use shell=True only for trusted strings.
