Python - SIGPIPE handled bug
Mark C Favas
mark at chem.uwa.edu.au
Fri Jan 21 19:58:38 EST 2000
Randall Hopper <aa8vb at yahoo.com> writes:
> ---------------------------------------------------------------------------
> > python -c "for i in xrange(1000): print 'Some output'" | head -2
> Some output
> Some output
> Traceback (innermost last):
> File "<string>", line 1, in ?
> IOError: [Errno 32] Broken pipe
> ---------------------------------------------------------------------------
On my system (1.5.2, latest from CVS, Tru64 (nee Digital) Unix 4.0F), the
above works perfectly under both csh and sh, viz:
120> python -c "for i in xrange(1000): print 'Some output'" | head -2
Some output
Some output
121> sh
$ python -c "for i in xrange(1000): print 'Some output'" | head -2
Some output
Some output
$ echo $?
0
$
However, if I put it into a file as:
117> cat junk2.py
def my_program():
for i in xrange(10000):
print 'Some output'
my_program()
118> python junk2.py | head -2
Some output
Some output
Traceback (innermost last):
File "junk2.py", line 5, in ?
my_program()
File "junk2.py", line 3, in my_program
print 'Some output'
IOError: [Errno 32] Broken pipe
I get your result. No solution, just another data point.
Mark
--
Email - mark at chem.uwa.edu.au ,-_|\ Mark C Favas
Phone - +61 9 380 3482 / \ Department of Chemistry
Fax - +61 9 380 1005 ---> *_,-._/ The University of Western Australia
v Nedlands
Loc - 31.97 S, 115.81 E Western Australia 6009
More information about the Python-list
mailing list