"placid" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi all, > > I have been looking into non-blocking read (readline) operations on > PIPES on windows XP and there seems to be no way of doing this. Ive > read that you could use a Thread to read from the pipe, but if you > still use readline() wouldnt the Thread block too? http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440554 > What i need to do is, create a process using subprocess.Popen, where > the subprocess outputs information on one line (but the info > continuesly changes and its always on the same line) and read this > information without blocking, so i can retrieve other data from the > line i read in then put this in a GUI interface. > > > readline() blocks until the newline character is read, but when i use > read(X) where X is a number of bytes then it doesnt block(expected > functionality) but i dont know how many bytes the line will be and its > not constant so i cant use this too. > > Any ideas of solving this problem? > > > Cheers I realized something very similar to what you described in http://sourceforge.net/projects/bestgui - the subprocess2.py module realizes the non blocking I/O - the outputparser.py module processes the output from the controlled process and updates the progress-bar, the status-bar and the log messages in the GUI. Incomplete lines are stored in a buffer and processed at the next read. ciao -- Antonio Valentino -- Posted via Mailgate.ORG Server - http://www.Mailgate.ORG -- http://mail.python.org/mailman/listinfo/python-list