I've seen this question asked here, but the answers given did not work in my case and was marked duplicate.
python -udoes not work forstdinin Python 3.sys.stdin = sys.stdin.detach()throws aValueError: underlying buffer has been detached.- None of these work for non-
stdininputs and other files being used as stream. - Adding a hook does not work:
FileInput(openhook=hook_nobuf)and usingopen(buffering=0)in the hook.
I dug in the source code (/usr/lib/python3.2/fileinput.py) and saw that readlines(bufsize) was being used internally to load a buffer. No shell or other piping shenanigans.