You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whilst trying to read an N-triples (.nt) file, I get this stack trace:
Traceback (most recent call last):
Graph().parse(f, format='nt')
File "[redacted]/.local/lib/python3.6/site-packages/rdflib/graph.py", line 1078, in parse
parser.parse(source, self, **args)
File "[redacted]/.local/lib/python3.6/site-packages/rdflib/plugins/parsers/nt.py", line 26, in parse
parser.parse(f)
File "[redacted]/.local/lib/python3.6/site-packages/rdflib/plugins/parsers/ntriples.py", line 150, in parse
self.line = self.readline()
File "[redacted]/.local/lib/python3.6/site-packages/rdflib/plugins/parsers/ntriples.py", line 173, in readline
buffer = self.file.read(bufsiz)
File "/usr/lib/python3.6/codecs.py", line 499, in read
data = self.bytebuffer + newdata
TypeError: can't concat str to bytes
where f = open(file, 'r').
RDFLib Version: 5.0.0
It seems to be working on Python 2.7 as is, OR on Python 3.6 by adding the rb mode to the open(), however, that is not required for xml nor n3 format values. One can, of course, use the n3 option for .nt files but that will probably cause a small overhead.
The text was updated successfully, but these errors were encountered:
@kouralex
Thanks for the bug report.
I think in this case most people probably either open with 'rb' as you suggested, or use the n3 parser, as you mentioned. Both of these are not ideal solutions, and we definitely need to get the ntriples parser updated to work properly in Python 3.6.
Whilst trying to read an N-triples (.nt) file, I get this stack trace:
where
f = open(file, 'r')
.RDFLib Version: 5.0.0
It seems to be working on Python 2.7 as is, OR on Python 3.6 by adding the
rb
mode to theopen()
, however, that is not required forxml
norn3
format values. One can, of course, use then3
option for .nt files but that will probably cause a small overhead.The text was updated successfully, but these errors were encountered: