harelba / q

q - Run SQL directly on delimited files and multi-file sqlite databases
http://harelba.github.io/q/
GNU General Public License v3.0
10.15k stars 419 forks source link

Exception ignored in _io.TextIOWrapper when piping output to less #317

Open harjoc opened 10 months ago

harjoc commented 10 months ago

After installing q 3.1.6 on Ubuntu-20.04 with Python 3.8.10 and running q "select * from my.csv" | less, it logs this when exiting from less:

Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>
BrokenPipeError: [Errno 32] Broken pipe

When running without less, the above message is not logged.

harjoc commented 10 months ago

For now I worked around it as described here: https://stackoverflow.com/questions/14207708/ioerror-errno-32-broken-pipe-when-piping-prog-py-othercmd

from signal import signal, SIGPIPE, SIG_DFL
signal(SIGPIPE, SIG_DFL)