← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #168326]: Watching process utilization to augment PSL

 

Question #168326 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/168326

    Status: Open => Answered

RaiMan proposed the following answer:
You can use the os.popen() to submit the top command and get the output
back to your script as a list of lines, that you can scan for the
result.

-- the principle:
import os
cmd = "some command" # see comment
lines = os.popen(cmd).readlines()
for line in lines:
    print line.strip() 

-- comment:
if command needs " for parameters:
cmd = r'command "parm 1"'

for your purposes you have to loop around that and insert some
processing for the line to filter out the end for the loop.

come back if not such familiar with Python programming.

You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.