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. Raghu. -- http://mail.python.org/mailman/listinfo/python-list