hat at se-126.se.wtb.tue.nl
Tue Sep 16 15:27:23 CEST 2003
On Sat, 13 Sep 2003 16:34:13 GMT, Doug <no.email.you.must.phone.me at fu.bar.ws> wrote:
> This works with a small string, but not a large one (read returns an
> empty string if i pass a large html file to tidy):
> >>> iin , iiout = popen2("tidy.exe -asxml")
> >>> iin.write(str)
> >>> iin.close()
> >>> iiout.read()
> I am using windows and tried the standard pipe and win32pipe as well.
Probably the standard pipe buffering problem.
As you know computer systems have a finite amount of memory, which is
used for many things, including buffering data written to a pipe.
The write(str) returns when you have written the entire contents out.
Since it is big, and tidy.exe also uses finite buffering, the latter
starts processing and returning data while you are writing. Since you
are not reading incoming data, the pipe in the other direction gets
full, tidy.exe becomes blocked, which in turn means your write() becomes
Solution: read and write at the same time.
Unlike popular belief, the .doc format is not an open publically available format.
More information about the Python-list