On Thu, 08 Aug 2013 23:11:09 -0500, Adam Mercer wrote:
> I'm trying to write a script that writes some content to a file root
> through sudo, but it's not working at all. I am using:
> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
You can't create a pipeline like this. All of the list elements after the
first will be passed as arguments to "echo".
Try:
command = ['sudo', 'tee', config_file]
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, _ = p.communicate('channel')
--
http://mail.python.org/mailman/listinfo/python-list