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.21k stars 423 forks source link

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

Open harjoc opened 1 year ago

harjoc commented 1 year 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 1 year 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)