bitly / data_hacks

Command line utilities for data analysis
http://github.com/bitly/data_hacks
1.94k stars 195 forks source link

Handle EPIPE error in sample.py #27

Open maxhawkins opened 9 years ago

maxhawkins commented 9 years ago

Previously, the program would raise an exception if piped to a program that closes the pipe before all the data is written. For example:

cat data.txt | sample.py 1/10 | head -n 1