Diez B. Roggisch wrote: > Efrat Regev schrieb: >> [EMAIL PROTECTED] wrote: >>> On May 1, 2:23 pm, Efrat Regev <[EMAIL PROTECTED]> wrote: >>> >>>> So my question is if there's a way to "grab" the output as it's being >>>> generated. It doesn't matter if the solution is blocking (as opposed to >>>> callback based), since threads can handle this. I just don't know >>>> how to >>>> "grab" the output. I appreciate your time in reading (and answering >>>> this), as I've been googling several hours for this. >>> >>> There may be more pythonic solution than what I suggest here but this >>> is what I have done when I needed similar functionality. Basically run >>> your command in the background and redirect its stdout/err to a temp >>> file. You may run the command either in the background or in a >>> separate thread. You can then run the command "tail --retry -- >>> pid=<pid> -n+0 -F <output_file>" and grab the output. The tail command >>> exits once the real command is done. > > Or instead use the python subprocess module and read the commands > stdin/out/err from the Popen-object. > > Diez
Excellent, thanks! BTW: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 (found this after seeing responses on list) -- http://mail.python.org/mailman/listinfo/python-list