pipe problem on FreeBSD....
Ng Pheng Siong
ngps at madcap.dyn.ml.org
Sun Jan 9 09:33:55 EST 2000
According to Steve Spicklemire <steve at spvi.com>:
> tryit.py:
> [snipped]
> fails on FreeBSD when invoked thusly:
>
> pluto.spvi.com> python tryit.py | head -3
> (83d0"@eKBdP5!!!!-m4F"e&*2!GP8I3!!!!!!!!!!!GD,D#@R`!!!!!!!!!!!!!
> !!!!!!!!!!!!+Mj!!!!!!!2rrrrp"8&"-8(PdB5%!Y(r$aE4r`mF!#5KQ!"-ic`!
> #f3d!"lAp(RrP2!!!!!!!!,iF"X"9[CqGcE0IZ3fdcPNc0pZq!aYXRD4GeXSrbYF
> Traceback (innermost last):
> File "tryit.py", line 12, in ?
> sys.stdout.write(s)
> IOError: [Errno 32] Broken pipe
Works for me on FreeBSD 2.2.5.
/tmp:$ cat 1.py
#!/usr/bin/env python
import sys
f=open('/etc/sendmail.cf')
while 1:
s=f.read(1024)
if not s:
break
sys.stdout.write(s)
f.close
/tmp:$ ./1.py | head -3
#
# Copyright (c) 1983, 1995 Eric P. Allman
# Copyright (c) 1988, 1993
Is there anything special with your file 'blah'?
--
Ng Pheng Siong <ngps at post1.com> * http://www.post1.com/home/ngps
More information about the Python-list
mailing list