The answer proposed by others:
for line in sys.stdin:
is very simple and pythonic, but it must be noted that the script will wait until EOF before starting to iterate on the lines of input.
This means that
tail -f error_log | myscript.py will not process lines as expected.
The correct script for such a use case would be:
line = sys.stdin.readline()
if not line:
From the comments it has been cleared that on python 2 only there might be buffering involved, so that you end up waiting for the buffer to fill or EOF before the print call is issued.