[chimera-dev] Direct standard output to Reply Log

user anchorwz at googlemail.com
Tue Dec 2 14:23:29 PST 2014


Hi,

I am new to write Chimera code. Right now I am trying to run another program as a subprocess within Chimera.
While I was trying to redirect the standard output from the subprocess to “Reply Log”, the results could be shown only after the subprocess finished but not simultaneously. I was wandering how should I redirect the output to “Reply Log” while the subprocess program is running.

Right now I have something like this:

def show(sub):
	for line in sub.stdout:
		replyobj.info(line)

subproc = SM.Popen(cmd, stdin=None, stdout = SM.PIPE, stderr=SM.PIPE)
subprog = SM.monitor(‘prog’, subproc, title=‘run’, task=task, afterCB=show(subproc))

If I run this block within the IDLE, then the result printed while it is running (seems still a bit delayed).
Where should I change?

Thank you in advance.

Zhe







More information about the Chimera-dev mailing list