“OSError: [Errno 2] No such file or directory” while using python subprocess with command and arguments

Use shell=True if you’re passing a string to subprocess.call.

From docs:

If passing a single string, either shell must be True or
else the string must simply name the program to be executed without
specifying any arguments.

subprocess.call(crop, shell=True)

or:

import shlex
subprocess.call(shlex.split(crop))

Leave a Comment