File access

Adrian Petrescu apetresc at
Thu Aug 2 19:00:42 CEST 2007

On Aug 2, 12:41 pm, JD <Jiandong... at> wrote:
> Hi,
> What I am trying to do is to run a subprocess on another machine using
> subprocess.Popen, this subprocess contuinue writing something into a
> file when it is runing.
> After submit this subprocess, I tried to open the file and readlines()
> in the loop (with a delay) in the loop) when the subprocess was
> runing.
> The problem is I could not get anything untill the subprocess
> finished.
> I also tried to run another python programm when the subprocess is
> runing, I could get what I want.
> Does anyone know why? Thanks!
> JD

Could the problem be that the subprocess only flushes the output
buffer when it terminates, and so until the subprocess "finishes", as
you say, the file is empty because the data is still in the buffer?
Trying throwing some flushes into the code and see if it helps.

Or am I misunderstanding your question?

More information about the Python-list mailing list