[BangPypers] Redirection of standard output to a variable

KartheeK kartheekpn at yahoo.co.in
Tue May 13 09:45:46 CEST 2008


I tried that too but it also  for some reasons fails to capture scp output although it can capture things like ping.
command.getstatusoutput  returns exit code but not the string.


gnuyoga <gnuyoga at gmail.com> wrote: KartheeK wrote:
> Hi Anand,
> This works for ls, I also tried it to capture ping.
> But for some unknown reasons it is not able to capture scp's output.
> The variable f is  empty.
> KartheeK
u have to get the standard error stream as well

u can take a look at commands module


import commands
print commands.getoutput('ls')

commands.getoutput returns output stream + error stream

- sree


Each soul is potentially divine. The goal is to manifest the divine by controlling nature, internal or external. Do this by work or worship or psychic control or philosophy by one or more, or all of these and be free.

BangPypers mailing list
BangPypers at python.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20080513/0cce7de0/attachment.htm>

More information about the BangPypers mailing list