I am writing a script and got it to work run and did everything I wanted it to. I want to add in a function to have my dictionary sleep after checking it but when I add the time.sleep(5) <-(5 seconds) it now throws me this error
AttributeError: 'module' object has no attribute 'check_output'
On this line of code
print ("INFO: checking kswapd number of process and cputime, check for TIME colume for how busy kswapd was" + subprocess.check_output("ps -C kswapd0 -C kswapd1 -C kswapd2 -C kswapd3 -C kswapd4 -o pid,ppid,stime,etime,time,pcpu,args", shell=True))
Any one know how I could use Pipe and Popen to get around using subprocess.check_output?
Or here is where I put the time.sleep() if you see that its not the right for any reason
with open("/proc/meminfo") as f:
sample1 = []
for line in f:
if line.startswith(pre):
v = line.rsplit(None, 2)[1]
sample1.append(v)
time.sleep(5)
I am in Python v2.6, and no I cannot upgrade otherwise I would! Thanks for any input!
subprocess.pyby any chance? Is your indentation wrong on the question or in your program? The body of the code after thewithshould be indented.