I am trying to run a script file of all of my Debian computers in my house, the script will get the /home/script
file from the Master machine when I call MPI to run it on all the machines. Right now I have to go onto each machine and do this command:
sudo scp -r max@10.0.0.216:/home/scripts /home
But I want it to be run within a Python script. Here's what I've come up with:
import subprocess
subprocess.check_call(["sudo", "-S", "scp", "-r", "max@10.0.0.216:/home/scripts", "/home"])
The error is the following:
sudo: sudono tty present and no askpass program specified:
no tty present and no askpass program specified
Traceback (most recent call last):
File "/home/scripts/Update-Scripts/script.py", line 3, in <module>
subprocess.check_call(["sudo", "scp", "-r", "max@10.0.0.216:/home/scripts", "/home"])
File "/usr/lib/python2.7/subprocess.py" line 190, in check_call
raise CalledProcessError(retcode,cmd)
subprocess.CalledProcessError: Command '['sudo', 'scp', '-r', 'max@10.0.0.216:/home/scripts', '/home']' returned non-zero exit status