0

how should i readout data from shell to python script variables.. ?

process = subprocess.Popen("rsh botham 'ps -eo fname | grep sublime'",shell=True, stdout=subprocess.PIPE)
process2= subprocess.Popen('hostname')
3
Contributors
5
Replies
58
Views
4 Years
Discussion Span
Last Post by krystosan
0

well i have been trying this on CentOS on tsch but not getting anything into the variable output

import subprocess

process = subprocess.Popen("rsh botham 'ps -eo fname | grep sublime'",shell = True, stdout = subprocess.PIPE, stderr = subprocess.PIPE)
pid = process.pid
print pid

xlp = process.poll()
output, error = process.communicate()
print output, xlp
0

yes the output doesnt prints anything but the line 3 outputs sublime_ twice because sublime is running twice on machine name botham

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.