I have a system call made from a Python script. I would like to have a timer as well as utilizing the output of the call. I was able to do one at a time: Implement a timer using subprocess.call() and retrieve the output using subprocess.Popen(). However, I need both timer and the output result.
Is there any way to achieve this?
Following code give me an Attribute error: 'int' object has no attribute 'stdout', because the subprocess.call output is not the Popen object I need to use.
... Open file here ...
try:
    result = subprocess.call(cmd, stdout=subprocess.PIPE, timeout=30)
    out = result.stdout.read()
    print (out)
except subprocess.TimeoutExpired as e:
    print ("Timed out!")
... Write to file here ...
Any help would be appreciated.
 
    