Have you tried:
def hook_nobuf(filename, mode):
return open(filename, mode, 0)
fi = fileinput.FileInput(openhook=hook_nobuf)
Not tested it, but from reading what openhook param does and what passing 0 to open for bufsize param, this should do the trick.