popen2: Broken pipe for large files
donn at u.washington.edu
Mon Jun 10 18:48:06 EDT 2002
Quoth Milos Prudek <milos.prudek at tiscali.cz>:
| In Python 2.1, is there a size limit when creating pipes with popen2() ?
| The following function fails because of a broken pipe if the size of T
| is larger than 21000:
| cmd='file -b -'
| X = r.read().split()
| print X
I suppose the "file" command only reads so much data (and probably
doesn't use all of that, as it is only interested in the top of the
file.) When python tries to write more data, the pipe is already
closed and that's an error.
| The only possible solution so far is to change the first line:
Sure, that will work, though it might be more economical to write
T = File.read(20000)
Donn Cave, donn at u.washington.edu
More information about the Python-list