If the parser reads an empty line from the input, it stops reading any further input. This is affecting the file and the console input devices.
The reason is that due to a limitation in Python, it's not easy to detect the end of file. The python method readline() returns an empty string when reading an empty line and when the EOF is reached.
The readline() method is returning the new line characters for empty lines. We can use it to distinguish between empty lines and EOF.
An alternative is to change the logic in the input devices to iterate over the stream object returning with yield. A hack for the file input device is to check the file size.
If the parser reads an empty line from the input, it stops reading any further input. This is affecting the file and the console input devices.
The reason is that due to a limitation in Python, it's not easy to detect the end of file. The python methodreadline()
returns an empty string when reading an empty line and when the EOF is reached.The
readline()
method is returning the new line characters for empty lines. We can use it to distinguish between empty lines and EOF.An alternative is to change the logic in the input devices to iterate over the stream object returning with
yield
. A hack for the file input device is to check the file size.