[Python-es] ¿cómo ver el stdout en tiempo real?
Arnau Sanchez
pyarnau en gmail.com
Mar Oct 26 09:15:37 CEST 2010
On Mon, 25 Oct 2010 19:09:04 -0400 Jose Caballero wrote:
> import time
> for i in range(3):
> print time.time()
> time.sleep(3)
Como bien comentaba Ricardo, aquí tenías buffering en la fuente. ¿Pero que
hubiera pasado si no hubieras podido modificar el script para poner el flush?
Una opción:
Popen("python -u tuscript.py", ...)
Otra (requiere stdbuf):
Popen("stdbuf -oL python tuscript.py", ...)
http://www.pixelbeat.org/programming/stdio_buffering/
Más información sobre la lista de distribución Python-es