i defined a function that switch my proxy settings every now and then, problem is that i want it to run in a loop without manual intervention. But when i execute the program
Here you can execute a command sudo without interactive prompt asking you to type your password :
from subprocess import call pwd='my password' cmd='ls' call('echo {} | sudo -S {}'.format(pwd, cmd), shell=True)