Yesterday, I wrote and ran a python script which executes a shell using subprocess.Popen(command.split()) where command is string whic
The error is because the executables are not given in the prescribed format for subprocess to execute it.
example:
shell_command1 = r"/path/to/executable/shell/file"
shell_command2 = r"./path/to/executable/shell/file"
subprocess.call(shell_command1) or subprocess.Popen(shell_command1) will not be able to run shell_command1 because subprocess needs an executable command like (mailx, ls, ping, etc.) or executable script like shell_command2 or you need to specify command like this
subprocess.call(["sh", shell_command1])
subprocess.Popen(["sh", shell_command1])
but however, you can use os.system() or os.Popen() as well