RDFLib/rdflib — Issue #20: nt parser fails when file has only whitespace after multiple of bufsiz bytes
Author: gjhiggins
Created: 2012-02-20 08:30:36+00:00
State: closed

azarot...@gmail.com, 2008-04-17T14:09:20.000Z

What steps will reproduce the problem?
1. Pick any valid N Triples file
2. Add 2048 whitespace characters
3. parse and see error

What is the expected output? What do you see instead?
Expected output is a graph.
Exception raised: EOF in line

What version of the product are you using? On what operating system?
Latest.

Please provide any additional information below.

Fix:

In rdflib/syntax/parsers/ntriples.py

Line 149, in readline() method:
while True:
m = r_line.match(self.buffer)
if m: # the more likely prospect
self.buffer = self.buffer[m.end():]
return m.group(1)
else:
buffer = self.file.read(bufsiz)
if not buffer and not self.buffer.isspace():
raise ParseError("EOF in line")
elif not buffer:
return None
self.buffer += buffer

Comment 1 by eike...@gmail.com
Thank you... I'll go ahead and apply the fix.

Comment 2 by eik...@gmail.com

Comment 3 by eik...@gmail.com

Comment 4 by eik...@gmail.com
This issue was closed by revision r1770.

Comment 5 by eik...@gmail.com
This issue was closed by revision 7bf73aed4a9a.