Position / Line Length Calculation
Closed this issue · 3 comments
It seems to me there's an issue with the calculation of position and line length.
In CsvRandomAccessReader._get_line_data, it should be:
lines.append({"position": start_position, "length": current_line + 1})
start_position += current_line + 1 + len(self._endline)
Instead of :
lines.append({"position": start_position, "length": current_line})
start_position += current_line + 1
Otherwise you're not taking into account the end-of-line character, and not counting the character in the start position in the line length calculation.
Did you encounter problems because of this? (As they say: If it ain't broke, don't fix it)
Yeap, it caused me problems. and making this change solved the problems for me.
Were you perchance running your code on a Windows machine (\n\r line endings)?