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
Another method of passing your password to a shell command through python that wouldn't involve it showing up in any command history or ps
output is:
p = subprocess.Popen(['sudo', self.resubscribe_script], stdin=subprocess.PIPE)
p.communicate('{}\n'.format(self.sudo_password))
Note that using communicate
will only allow one input to be given to stdin; there are other methods for getting a reusable input.