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: bangpypers@python.org 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 BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers
_______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers