On Thu, 09 Dec 2010 19:39:52 -0000, Guilherme Salgado <email address hidden> wrote:
> The nice thing is that it works with communicate() just fine as communicate() wait()s:
>
> >>> p = Popen('false', stdout=PIPE, stdin=PIPE, stderr=PIPE)
> >>> p.communicate('')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/python2.6/subprocess.py", line 691, in communicate
> return self._communicate(input)
> File "/usr/lib/python2.6/subprocess.py", line 1258, in _communicate
> self.wait()
> File "media_create/cmd_runner.py", line 38, in wait
> raise SubcommandNonZeroReturnValue(self._my_args, returncode)
> media_create.cmd_runner.SubcommandNonZeroReturnValue: Sub process "false" returned a non-zero value: 1
Ah, ok.
Is it still possible to get the output when using communicate() with
pipes?
I'm not sure we do that anyway right now, but there are cases when you
have to use communicate, with stdout/stderr pipes, and you want to
report the output if the command fails.
On Thu, 09 Dec 2010 19:39:52 -0000, Guilherme Salgado <email address hidden> wrote: python2. 6/subprocess. py", line 691, in communicate te(input) python2. 6/subprocess. py", line 1258, in _communicate create/ cmd_runner. py", line 38, in wait roReturnValue( self._my_ args, returncode) cmd_runner. SubcommandNonZe roReturnValue: Sub process "false" returned a non-zero value: 1
> The nice thing is that it works with communicate() just fine as communicate() wait()s:
>
> >>> p = Popen('false', stdout=PIPE, stdin=PIPE, stderr=PIPE)
> >>> p.communicate('')
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/usr/lib/
> return self._communica
> File "/usr/lib/
> self.wait()
> File "media_
> raise SubcommandNonZe
> media_create.
Ah, ok.
Is it still possible to get the output when using communicate() with
pipes?
I'm not sure we do that anyway right now, but there are cases when you
have to use communicate, with stdout/stderr pipes, and you want to
report the output if the command fails.
Thanks,
James