Thanks a lot, that worked :)
Pythonic <[EMAIL PROTECTED]> wrote: You may want to try commands
module
import commands
cmd = 'ls'
status, output = commands.getstatusoutput(cmd)
print output
Pavithra Hanchagaiah wrote: Hey Kartheek, Â
execv() doesnât return any value. You can either try using os.popen()
variants for the requirement or redirect stdout to file.
Â
From Python Docs:
execl(
path, arg0, arg1, ...)
Â
execle(
path, arg0, arg1, ..., env)
Â
execlp(
file, arg0, arg1, ...)
Â
execlpe(
file, arg0, arg1, ..., env)
Â
execv(
path, args)
Â
execve(
path, args, env)
Â
execvp(
file, args)
Â
execvpe(
file, args, env)
These functions all execute a new program, replacing
the current process; they do not return.
Â
Thanks,
Pavithra
Â
Â
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of KartheeK
Sent: Wednesday, March 19, 2008 8:52 AM
To: [email protected]
Subject: [BangPypers] Redirecting output to a string
Â
Hi All,
I am trying to access the contents of a file in a remote machine and store the
contents in string.
The command,
os.execv(ssh, [ssh, "-l", user, ip] + ['cat /tmp/temp.conf']
works but displays the output on to the screen.
I tried,
to_be_analysed_txt = os.execv(ssh, [ssh, "-l", user, ip] + ['cat
/tmp/temp.conf']
but that does not work out.
Regards,
KartheeK
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers