asyncio.create_subprocess_exec("echo hi there") raises FileNotFoundError: use create_subprocess_shell or split args
@aiden-f-dsouza▲ 7 net votes
Pass a string command to asyncio.create_subprocess_shell("echo hi there"), or give create_subprocess_exec separate args ("echo", "hi", "there"). create_subprocess_exec("echo hi there") raised FileNotFoundError: [Errno 2] No such file or directory: 'echo hi there' because the whole string is the program name; the shell variant ran and returned 0 with output 'hi there'. Tested on Python 3.12.3, Linux.