On Fri, 09 Aug 2013 21:12:20 +0100, Nobody wrote:
> Try:
>
> command = ['sudo', 'tee', config_file]
> p = subprocess.Popen(command, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE)
> out, _ = p.communicate('channel')
Oops; you also need stdin=subprocess.PIPE.
--
http://mail.python.org/m
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
On 9 August 2013 23:21, Adam Mercer wrote:
> On Thu, Aug 8, 2013 at 11:47 PM, David wrote:
>
>> At a quick glance, I have a couple of suggestions.
>>
>>> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
>>
>> sudo doesn't work like this. It doesn't read from standard input. Yo
On Fri, Aug 9, 2013 at 2:50 PM, Adam Mercer wrote:
> On Fri, Aug 9, 2013 at 8:42 AM, Antoon Pardon
> wrote:
>
>> That is probably beside the point. I suspect Adam is just giving a
>> minimal example to show the kind of thing he is trying to do.
>>
>> Nit picking the specific example instead of ad
Op 09-08-13 06:11, Adam Mercer schreef:
> Hi
>
> 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:
>
> channel = 'stable'
> config_file = '/opt/ldg/etc/channel.conf'
> command = ['echo', '-n', channel, '|', 'sudo',
On Fri, Aug 9, 2013 at 8:42 AM, Antoon Pardon
wrote:
> That is probably beside the point. I suspect Adam is just giving a
> minimal example to show the kind of thing he is trying to do.
>
> Nit picking the specific example instead of advising on the problem
> is likely to be less than helpful.
I
On Fri, Aug 9, 2013 at 8:29 AM, Chris Angelico wrote:
> You shouldn't need to use 'echo' here. Just provide tee with the text
> on its standard input, and don't bother with the pipe at all.
Thanks, that's much better!
Cheers
Adam
--
http://mail.python.org/mailman/listinfo/python-list
Op 09-08-13 15:29, Chris Angelico schreef:
> On Fri, Aug 9, 2013 at 2:21 PM, Adam Mercer wrote:
>> command="echo -n %s | sudo tee %s > /dev/null" % (channel, config_file)
>>
>
> You shouldn't need to use 'echo' here. Just provide tee with the text
> on its standard input, and don't bother with th
On Fri, Aug 9, 2013 at 2:21 PM, Adam Mercer wrote:
> command="echo -n %s | sudo tee %s > /dev/null" % (channel, config_file)
>
You shouldn't need to use 'echo' here. Just provide tee with the text
on its standard input, and don't bother with the pipe at all.
ChrisA
--
http://mail.python.org/ma
On Thu, Aug 8, 2013 at 11:47 PM, David wrote:
> At a quick glance, I have a couple of suggestions.
>
>> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
>
> sudo doesn't work like this. It doesn't read from standard input. You
> need to supply the command as an argument to sud
Am 09.08.2013 05:47, schrieb David:
On 9 August 2013 14:11, 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:
[...]
At a quick glance, I have a couple of suggestions.
command = ['echo', '-n', ch
On 9 August 2013 14:11, 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:
[...]
At a quick glance, I have a couple of suggestions.
> command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_
On Thu, 08 Aug 2013 23:11:09 -0500, Adam Mercer wrote:
> Hi
>
> 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:
>
> channel = 'stable'
> config_file = '/opt/ldg/etc/channel.conf'
> command = ['echo', '-n', channe
Hi
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:
channel = 'stable'
config_file = '/opt/ldg/etc/channel.conf'
command = ['echo', '-n', channel, '|', 'sudo', 'tee', config_file]
p = subprocess.Popen(command, stdo
14 matches
Mail list logo