Other difference with Perl: Python scripts in a pipe

Fillmore fillmore_remove at hotmail.com
Thu Mar 10 16:33:54 EST 2016


when I put a Python script in pipe with other commands, it will refuse 
to let go silently. Any way I can avoid this?
$ python somescript.py | head -5
line 1
line 3
line 3
line 4
line 5
Traceback (most recent call last):
 File "./somescript.py", line 50, in <module>
 sys.stdout.write(row[0])
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' 
encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
thanks


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /